Partition table entries

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
manchev

Partition table entries

Post 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
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Partition table entries

Post 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 ;)
manchev

Re:Partition table entries

Post by manchev »

thanks again, Pype.Clicker. i will follow your advice ;)


:manchev
Post Reply