-   Linux - General (
-   -   Backup/Restore Master Boot Record (

marktin 04-05-2004 12:29 PM

Backup/Restore Master Boot Record
Hello -

I am using a dual boot machine running Windows XP (Home) and SuSE Linux 9.0. Due to XP problems, I think I will have to do a complete re-install of XP (won't even start in Safe Mode). My Linux "side" is working fine, and I don't want to lose this. My understanding is that if I do a fresh install of XP, I will lose my current Master Boot Record. If this is so, than I will lose access to dual booting - and my currently working Linux installation. Can anyone tell me how to save my current Master Boot Record and then how to restore it once XP has been re-installed? This is all new territory for me, so the more details you can provide the better!

Thank you!

aaa 04-05-2004 12:40 PM

dd if=/dev/hda of=/dev/fd0 bs=512 count=1
This copies yout MBR to a floppy (don't copy back to hd this way). You can use that floppy to boot your Linux as if nothing happened. Then, after XP is installed, you can run 'lilo' or 'grub-install /dev/hda' to restore bootloader to hd.

ugge 04-05-2004 12:50 PM

If you would like to make backup file of your MBR then you could run
dd if=/dev/hda of=<some directory>/MBR.img bs=512 count=1

aaa Why won't it work to reverse the floppy command?

aaa 04-05-2004 01:18 PM

The mbr also contains partition information, which you wouldn't want to copy, especially if the information is different (say a different hd or you changed your partitions). To copy back safely, you will have to modify the 'dd' command to skip 16 bytes of the mbr. Not sure if it's first or last though.

marktin 04-05-2004 01:36 PM

Thanks aaa and ugge.

aaa - Can you provide me with a bit more detail on the restore? I assume I do this from a DOS prompt. What exactly do I need to type in?

Will this just copy the GRUB information back just the way it was, so the next time I boot I will be presented with the dual boot choice?

Thanks again. Sorry I need so much hand-holding here. I'm not experienced in this area. It took me a while to get Linux running, and I just don't want to have to do it all over again!

Thanks again!

aaa 04-05-2004 01:50 PM

You do this all from a Linux prompt as root. For restoration you reinstall the bootloader, running 'lilo' for the LILO bootloader, 'grub-install /dev/hda' for the GRUB bootloader. This should put things back they way it was. The floppy you make with 'dd' will let you boot Linux even after the MBR is erased.

marktin 04-05-2004 02:04 PM

OK. So when I re-boot, I put the floppy created in step one in the drive, then boot. This boots me to SuSE Linux instead of XP. Once in Linux, I log in as root. Then I type in the GRUB-install command which restores the MBR, and on my next re-boot I should see the dual boot choice, allowing me to boot to XP or to Linux. Do I finally have it correct?

- a million thanks!

aaa 04-05-2004 02:12 PM


michaelk 04-05-2004 02:35 PM

This looks reasonable...

All times are GMT -5. The time now is 09:34 PM.