LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 04-05-2004, 12:29 PM   #1
marktin
LQ Newbie
 
Registered: Dec 2003
Posts: 10

Rep: Reputation: 0
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!
 
Old 04-05-2004, 12:40 PM   #2
aaa
Guru
 
Registered: Jul 2003
Location: VA
Distribution: Slack 10.1
Posts: 2,194

Rep: Reputation: 46
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.
 
Old 04-05-2004, 12:50 PM   #3
ugge
Senior Member
 
Registered: Dec 2000
Location: Gothenburg, SWEDEN
Distribution: OpenSUSE 10.3
Posts: 1,028

Rep: Reputation: 45
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?
 
Old 04-05-2004, 01:18 PM   #4
aaa
Guru
 
Registered: Jul 2003
Location: VA
Distribution: Slack 10.1
Posts: 2,194

Rep: Reputation: 46
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.
 
Old 04-05-2004, 01:36 PM   #5
marktin
LQ Newbie
 
Registered: Dec 2003
Posts: 10

Original Poster
Rep: Reputation: 0
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!
 
Old 04-05-2004, 01:50 PM   #6
aaa
Guru
 
Registered: Jul 2003
Location: VA
Distribution: Slack 10.1
Posts: 2,194

Rep: Reputation: 46
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.
 
Old 04-05-2004, 02:04 PM   #7
marktin
LQ Newbie
 
Registered: Dec 2003
Posts: 10

Original Poster
Rep: Reputation: 0
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!
 
Old 04-05-2004, 02:12 PM   #8
aaa
Guru
 
Registered: Jul 2003
Location: VA
Distribution: Slack 10.1
Posts: 2,194

Rep: Reputation: 46
Yes.
 
Old 04-05-2004, 02:35 PM   #9
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,926

Rep: Reputation: 747Reputation: 747Reputation: 747Reputation: 747Reputation: 747Reputation: 747Reputation: 747
This looks reasonable...
http://www.xaff.org/GI/mbr.html
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
whats a good program to backup my master boot record FocusedWolf Linux - General 11 03-15-2005 09:55 PM
master boot record help sfr7 Linux - Laptop and Netbook 10 04-25-2004 08:52 AM
Master Boot Record linuxuser05 Linux - General 3 01-11-2004 06:57 PM
master boot record alaios Linux - General 1 04-22-2003 08:41 AM
master boot record dark_light Linux - General 11 07-03-2002 05:21 AM


All times are GMT -5. The time now is 07:40 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration