Posts tagged with mbr

Backup your MBR

March 21st, 2008

In relation to the post ‘Overwrite MBR from Linux’ this is how to take a backup and restore your current Master Boot Record (MBR) in case you accidentally wipe it. This assumes your main disk is called /dev/sda plus all command must be run as root.

To backup:

dd if=/dev/sda of=~/mbr.image  bs=512 count=1

This saves your MBR in your home directory and names it mbr.image

Now to restore:

dd if=~/mbr.image of=/dev/sda  bs=512 count=1

Overwrite MBR from Linux

February 21st, 2008

If, like me, you are experimenting setting up usb drives as bootable Linux devices then you’ll find that after installing grub on the drive just deleting all the files will not remove grub. You need to completely wipe the Master Boot Record (MBR). Assuming your drive is located at /dev/sdb use this command as root:

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

Be very careful to do this on the correct drive! One error and you will wipe the MBR on your main hard drive leaving your computer unable to boot.