You are a geek therefore you can’t trust your self to not render a system unbootable. Specially if you are about to boot from more than one operating system which is done incorrectly could result in getting a blank screen. BTW: The MBR holds partition data and Operating System boot essential data. Therefore, it’s essential to know how to backup the MBR, fortunately we can backup with a few simple steps and only using free tools.
MBR = Master Boot Record
This tutorial uses a Live CD which includes the utility know as dd with can be used to copy entire drives or just sections of it. First of all you should boot in to your Linux environment and mount a second drive where we can store the MBR backup.
Do not save the backup file in the same drive from which you are making the backup.
Create a directory.
mkdir mountusb
Use the ls command to identify the second drive. In my case I have a SATA drive and a USB drive, the SATA drive is always assigned the first letter of the alphabet in this case it’s named sda and the USB drive was assigned the name sdb.
root@PartedMagic:~# ls /dev/sd*
/dev/sda /dev/sda1 /dev/sdb /dev/sdb1
You can’t mount the drive itself, instead you have to mount partitions. In this case I will be mounting a USB drive which is where I will be storing the MBR backup, remember to mount the partition not the drive.
mount /dev/sdb1 mountusb
And now we back up the MBR aka the first 512 bytes.
dd if=/dev/sda count=1 bs=512 > mountusb/sda.mbr
Restoring the MBR follows similar steps, you first need to mount the drive where the MBR was backup to and use the dd command to restore the backup to the desired drive.
dd if=mountusb/sda.mbr of=/dev/sda
Now that you know how to backup the MBR go ahead and start playing with multiple operating system, if at a latter time you decided to remove them you can always revert to the original MBR with a single command. Thanks for reading.
dd, linux, mbr, windows — Sep 19, 2011