Tips Linux Explorers   All Things Linux Forum   Great Linux Links   Hometown    

MBR / Hard Disk Layout

The MBR is the very first part of your hard disk stores the boot loader and the partition table.

Basically it comes to this:
The MBR is 512 bytes . . the first 446 bytes are for the boot loader, and the bytes from 446 to 512 are for the partition table. If you delete the full 512 bytes you will not only delete the boot loader but you will have lost the partition table as well . . . so . . be careful !

If you back up the MBR to floppy you do:

# dd if=/dev/hda of=/dev/fd0/boot.mbr bs=512 count=1

Once the disk is clean and you want to restore:

# dd if=/dev/fd0/boot.mbr of=/dev/hda bs=512 count=1

This will restore the original partition table and the boot loader you had in the MBR.

Now, if you only want to clear the boot loader part ( and keep the partition table intact ) you do:

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

Then you can either restore your favorite Linux boot loader, see Grub or Lilo info ( sure you will need a rescue CD or boot CD first to boot or chroot the Linux partition ) or you can restore your Windows boot loader ( see Here )

Technical info on recovering a deleted partition table: ( warning: this is not easy ! )


-- Feb 6 2006 --

Tips Linux Explorers   All Things Linux Forum   Great Linux Links   Hometown