When is the MBR created

When is the MBR created or made? Does installing Windows XP or Windows 7 completely overwrite the MBR? I was wondering say in a situation where somebody had installed GRUB or GRUB-2 to the MBR, what will restore the MBR to its pristine condition? Will doing what the hard disk manufacturer calls a low-level format restore or delete the MBR.
 

mqudsi

Mostly Harmless
Staff member
Yep. Whenever you install a new OS, it'll typically overwrite the MBR on the boot drive.

Installing GRUB won't restore the MBR, it'll overwrite it with its own copy.
 
You say Windows will typically overwrite the MBR. I’m just trying to figure out what is the easiest and fastest method overwrite the MBR completely with absolute certainty. What about a wipe program that writes zeros and ones to the hard disk. What about FDISK/MBR. Will that overwrite the entire master boot record or only restore the parts of the master boot record related to DOS?
 

mqudsi

Mostly Harmless
Staff member
The MBR is the very first 512 bytes of the hard disk. You can overwrite it with zeros very easily from any Linux or Mac with this command:

dd if=/dev/zero of=/dev/sda bs=512 count=1
And you can overwrite it from Windows by using the bootsect.exe with the /mbr flag
 
Top