Page 1 of 1

Partition table entries

Posted: Thu May 29, 2003 6:46 pm
by manchev
here is another question connected with the boot sector. if i want to transfer my self made boot sector to the hard disk and overwrite my original mbr how should i save the partition table in the new mbr so the disk would be readable? my intention is to overwrite the mbr so the partitions and all the information stay untouched. best regards,


:manchev

Re:Partition table entries

Posted: Fri May 30, 2003 1:20 am
by Pype.Clicker
according to http://www.nondot.org/sabre/os/files/Pa ... Tables.txt, only the first 466 bytes of the MBR are bytes of code. The last 2 bytes of the MBR are the 55AA signature and it is preceded by 4 * 16 entries which actually describe the partitionning.

So just read the current MBR, and place the code you wish within the 466 low bytes, then write back. This cannot be done with tools like "rawcopy" or "cat >/dev/xxx", afaik: you'll have to make a small system program (maybe that will run as a floppy bootsector) that do the read - change - writeback commands ...


btw, i strongly suggest that you first pick a snapshot of your partition table with a tool like norton diskedit so that you can restore it in case of failure ...
When i tried to play the firtst time, i messed up a "READ" and a WRITE" and boom ... no partitions anymore. No backup. Just raw hardware ... So be wiser than me ;)

Re:Partition table entries

Posted: Fri May 30, 2003 2:18 pm
by manchev
thanks again, Pype.Clicker. i will follow your advice ;)


:manchev