Backup and restore your mbr (master boot record)

In Linux making block level copies of area’s is easy with the magical dd utility.   So to backup the mbr (first 512 bytes)  use this command (assuming your boot drive is hda)

dd if=/dev/hda of=/root/mbr_backup bs=512 count=1

Now in /root/mbr_backup you have a complete copy of your mbr.   BS means byte size and count means only (once) first 512.

To delete the mbr (not the partition table):

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

To delete the mbr and partition:

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

Restore the mbr:

dd if=/root/mbr_backup of=/dev/hda bs=512 count=1



			

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.