Backup And Restore MBR

Virus's, Windows mess up, whatever the reason we all know its nice to have a backup of your master boot record. And its also nice to be able to restore that master boot record. Heres how.


Save the MBR


To make a backup of your MBR, run the following command as root


dd if=/dev/sda of=MBR.dump bs=512 count=1


If you do not know the path to your hard drive, fdisk -l can help you.


Restore MBR


To restore the MBR is a little less straightforward because you have to do it using a liveCD. Download and boot up your favorite linux livecd, open up a terminal window type the following.


sudo dd if=MBR.dump of=/dev/sda