Windows – How to zero out the boot code of a MBR

bootsectorhard drivewindows

I have two drives in my Windows system:

  • Drive 1, System and Boot.
  • Drive 2, data storage.

Some time previously, I had Windows installed on the second drive. Now that I have the current setup, I would like to remove the boot code from Windows from the bootsector on Drive 2. To be specific, I do not want to erase the partition table or anything, just get rid of (zero out) the little bit of code that looks for NTLDR.

Is there a software or command to do this?

Best Answer

The MBR, in the case of DOS-style partition tables, is always present on the drive as a very small collection of sectors at the start of the drive.

It's not a thing to get rid of, because it contains, in addition to boot code, the partition table of your drive. Losing that means that the data on your disk, while intact, is suddenly a lot harder to get at (most OS'es I've seen will report a bad format and windows asks if you want to format the drive if it doesn't understand the partition table).

More info: http://technet.microsoft.com/en-us/library/cc976786.aspx

Edit: since you edited the question, I'll update my answer; dd can wipe it. Boot into a linux livecd and on your unmounted data drive run;

dd if=/dev/<path to data drive> of=/dev/<somewhere safe on windows drive>/mbr.img bs=512 count=1

This will give you a 512-byte backup of the MBR including partition table, in case anything goes wrong.

To wipe the 446-byte bootstrap:

dd if=/dev/zero of=/dev/<path of data drive> bs=446 count=1 seek=0

Depending on what you are trying to achieve you might only want to wipe the first 440 bytes of the MBR. The 4 bytes following the first 440 bytes contain the Windows Unique Disk Signature which you might want to retain. To wipe only the first 440-bytes use this command:

dd if=/dev/zero of=/dev/<path of data drive> bs=440 count=1 seek=0
Related Question