Linux/UNIX dd command in combination with a tool such as Linux's hexedit
The way I started out...
dd if=/dev/hd* of=[FILE ...] bs=512 seek=[SECTOR ...] count=1 hexedit [FILE ...] dd if=[FILE ...] of=/dev/hd* bs=512 skip=[SECTOR ...] count=1
I may as well have just been using hexedit alone as this use of dd is pointless, instead I should have been using dd to make a backup before I start tampering.
dd if=/dev/hd* of=[FILE ...] bs=512 seek=[SECTOR ...] count=1 hexedit /dev/hd*
Either use hexedit to jump to specific sector on device (can't find anyway to do this) or copy backup, edit it and then apply changes using.
dd if=/dev/hd* of=[FILE ...] bs=512 seek=[SECTOR ...] count=1 cp [FILE ...] [BACKUP OF FILE ...] hexedit [FILE ...] dd if=[FILE ...] of=/dev/hd* bs=512 skip=[SECTOR ...] count=1
If you produce a problem simply restore the backup
dd if=[BACKUP OF FILE ...] of=/dev/hd* bs=512 skip=[SECTOR ...] count=1
Linux hexedit alone
hexedit /dev/hd*
Symantec's Norton diskedit for Dos
Though sfdisk can't be used to solve all partitioning problems, it can be be used to assist in diagnosing the problem. For example the following sfdisk statement will list your entire partition table detailing exact starting and number of sectors per partition.
sfdisk -xd /dev/hd*
The benefit of using Parts over Norton diskedit is mainly that it provides a level of analysis and you can easily use Parts within scripts, ahh good old automation. And the benefit of using Parts over Linux's hexedit and dd is that Parts presents details in a normal (dare I say human readable) form.
Just to make my examples above completely clear
- /dev/hd* is refering to the device of interest, say /dev/hda
- [SECTOR ...] is refering to the sector of interest, say 0
- [FILE ...] is refering to where you have chosen to store sector of interest, say /root/sec.dmp
- [BACKUP OF FILE ...] is refering to where you have chosen to store backup of sector of interest, say /root/sec.bkp
Supporting tools
I have created these tools for a couple of reasons:
- Not being particularly familiar with Linux I don't know of all the different standard utilities.
- I wanted something simple that wouldn't require a GUI to be available.
nsconvert - to convert between different number systems (binary, octal, decimal, hexidecimal and Intels backward hexidecimal). This is a handy tool when using Linux's command line hexedit.
dmp - simplified command line interface for dd. I built this when I was regularly dumping and changing the partition table, before I had built Partsedit. Subsequently I was concerned I may stuff up somewhere along the line.