How to save / restore MBR ?

B

Baron Samedi

Specifically, I dual boot windows and Linux. Every six months or so,
Windows gets hosed up, and I feel the need to reinstall.
Unfortunately, that overwrites the MBR, where the Linux GRUB loader is
(so I end up reinstalling Linux too).

Is there any freeware available to get around this problem? I would
like it to save the MBR juts before I reinstall Windows and restore it
again afterwards.

Thanks in advance for any help.
 
R

Rich Barry

You can do that using Knoppix. Found this in the O'Reilly Book "
Knoppix Hacks ". At the Terminal Prompt

Save MBR



knoppix$ sudo dd if = /dev/hdx of = /home/knoppix/mbr_backup bs=512
count=1 hdx = system drive or partition



Restore MBR



knoppix$ sudo dd if = /home/knoppix/mbr_backup of = /dev/hdx
bs=446 count=1 Restores just MBR



knoppix$ sudo dd if = /home/knoppix/mbr_backup of = /dev/hdx
bs=512 count=1 Restores both MBR and PT
 
J

John John

Just do a search on "restore grub" or "restore grub loader" and you will
find the information that you need. It is quite unnecessary to
reinstall operating systems just to change the boot loader.

John
 
G

Guest

Baron:

I have used the Ultimate Boot CD which has a utility that will save the mbr.
Using the Ultimate Boot CD requires you to download an image and burn it to
cd, but it's a good resource of legally free tools.
Ranish Partition Manager allows you to backup the mbr to its bootable floppy.
There's a Boot Partition manager with it that's helpful.
I've also used XOSL Boot Loader and can manage os's under it.
http://www.ranish.com/part/

Good Luck,
 
G

Guest

MBR Backup and Restore
You can back up your MBR with a Linux Live CD such as a ubuntu 'desktop'
Live/Install CD or Knoppix or similar before you begin your Linux
installation.

You can use any media you like to copy the MBR backup file to and store it
on. In this example I used a USB disk. You may use a floppy disk or a CD-ROM
just as easily.

It isn't compulsory to name your MBR file 'OLDMBR.img', you might be better
off naming it something like 09june06_MBR.img instead. I find having the date
as part of the file-name can be quite handy at times when it comes time to
find my old files and i need to decide which one is the one I really want to
use and which ones to delete to the trash.

To USB disk:

1) Plug in USB disk cord or check to see that it is already plugged in.

2) Boot your Live CD. (Ubuntu Desktop in this example).

3) Choose Start or Install Ubuntu

4) After boot-up, USB disk icon(s) should appear on the desktop.

5) Open a terminal (Applications, Accessories, Terminal)

6) code:
sudo dd if=/dev/hda of=/home/ubuntu/OLDMBR.img bs=446 count=1



7) quote:
1+0 records in
1+0 records out
446 bytes copied, 4.3e-05 seconds, 10.4 MB/s

8) Open /home/ubuntu directory, locate file named OLDMBR.img

9) Open USB drive (FAT32 partition), drag and drop OLDMBR.img there somewhere.

10) Carry on with your Ubuntu Install.

Warning:

You can make a backup copy of your MBR with the entire 512 bytes, which
includes the entire MBR meaning the partition table and 55 aa signature.

That may be useful for some purposes, but be sure you destroy that copy of
your MBR if you decide to re-partition your disk later. If you accidentally
restore your MBR backup with an out of date partition table, it will not
match your new filesystems. It will cause your disk to be unreadable. Unless
it is very important data you will probably have to give it up and reformat
and repartition your disk and loose all your data and have to start again.

If you only want the to make a backup copy of the bootloader code, you only
need the first 466 bytes of the MBR, so it will not include the partition
table. That is much safer. That is what I do, and what is shown here.




11) Restore command:

code:
sudo dd if=/home/ubuntu/OLDMBR.img of=/dev/hda bs=446 count=1
Where: ubuntu is your username (it is the default username for the live CD),
and where: OLDMBR.img is the name of your MBR backup file.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top