Backup & Restore your Master Boot Record (MBR)
All hard drives have a Master Boot Record (MBR). This record is used when booting your computer. It also holds information about the hard disk's partitions. If something happens to the MBR on your hard drive, you could potentially lose access to your data and your computer may not boot. For this reason, you should keep a backup of your hard drives' MBRs.
When setting up dual boot, you should backup your MBR before install the second operating system as it may very likely overwrite your MBR.
Backing up the MBR
You need to be in a Linux OS to follow these steps. If your computer is running Windows, you can boot off a Linux boot CD.
dd if=/dev/sda of=/backups/sda.mbr bs=512 count=1
if= specifies where it will copy FROM. Change sda to whatever your hard drive is (ie: hdb, or sbc). Do not specify a partition (don't put a number at the end - ie: sda1).
of= specifies where you want copy TO. You can call this whatever you want. It should be a file and not another device.
You can treat this backup file like any other file. You can upload it to an online backup, put it on CD, or include in some network backups.
Restoring the MBR
Let's assume you can't boot the computer (since your MBR is corrupt). Boot your computer with a Linux live CD. Get access to your backup file somehow (put the CD in, access the network, etc...). Determine what device file points to the hard drive you are restoring.
dd if=/path/to/backup/file of=/dev/sda bs=512 count=1
Replace /dev/sda with the actually device file for your hard drive.




backup

Comments
There are no comments yet.