Remove Master Boot Code but leave Partition Table

editingmbr

For testing purposes, I need to fidget with the MBR on a Windows7 test host: I'd like to remove the Master Boot Code but leave the Partition Table within.

Does the following Linux command do this, or does it wipe out the entire MBR, including the Partition Table?

dd if=/dev/zero of=/dev/hda bs=512 count=1

Thank you.

Best Answer

That command will remove the partition table. If you want to remove the MBR and keep the partition table:

dd if=/dev/zero of=/dev/hda bs=446 count=1

See Wikipedia's MBR page for the MBR layout. The primary partition table starts at byte 446 (counting from zero).