PDA

View Full Version : backing up the MBR



nishtya
10-24-2004, 05:33 PM
Okie, I need to reinstall windows which resides on the 3 partitions of hda. I have my kanotix install on hdb5 and a gimpy install of mandrake on hb6. I use grub menu on hdb5 and the bootloader is in mbr. Kanotix my default o/s

I know from going through this a few weeks ago on spare box that windows is going to blow away the mbr and I will have to fix. I forget how I fixed it (most faqs and posts assume you have gotten in there with a floppy and it goes easy). The only way I will get linux is with a live CD that mounts everything readonly and the directions on how to get grub back under those conditions - well, I can't find it anywhere now :cry:

Found this though here:
A: To backup use "sudo dd if=/dev/hda of=mbr.backup bs=512 count=1" and "sudo dd of=/dev/hda if=mbr.backup bs=512 count=1" to restore.

err, OK. Sounds handy. But where is this backing the information up to? I will be reformatting the partitions of the windows drive (same partition info, just wiped and starting fresh).

Help appreciated. Will have my hands full installing windows from scratch and I want to get my kanotix back first thing.

baldyeti
10-24-2004, 06:45 PM
The commands you mentioned are correct, but copy the mbr to a file name mbr.backup in the cwd. Obviously you need to move this tiny one block file to either a floppy or some partition you intend to keep (not NTFS preferably). A network copy or flash key are other possibilities.

nishtya
10-24-2004, 07:10 PM
I have wiped the 2 of three windows partitions (3rd on the disk is just data) but haven't reinstalled so the mbr is still intact at this point. Will give this a shot...if it doesn't work, anybody know of the excellent link to a post here that went into the having to redo grub with a live CD? I know I chrooted something or other but search hasn't found it again for me. I think it was here, may have been linuxquestions.org but nothing found there either. Thanks baldyeti

mzilikazi
10-24-2004, 08:37 PM
I have wiped the 2 of three windows partitions (3rd on the disk is just data) but haven't reinstalled so the mbr is still intact at this point. Will give this a shot...if it doesn't work, anybody know of the excellent link to a post here that went into the having to redo grub with a live CD? I know I chrooted something or other but search hasn't found it again for me. I think it was here, may have been linuxquestions.org but nothing found there either. Thanks baldyeti

Piece of cake:
Boot the Kanotix cd.

su
mount /dev/hda1 /mnt/hda1
grub-install --root-directory=/mnt/hda1 --recheck --no-floppy /dev/hda

Of course if you installed Kanotix in another partition besides hda1 then you'll need to change the --root-directory= option accordingly.

nishtya
10-24-2004, 10:32 PM
mzi, I tried that --- what Kano has over in kanotix forum. Got "operation not permitted". Su doesn't work on live cd? Tried it with sudo. Got something about a bin not existing. Then went through some contortions with device busy. I unmounted. I chmodded 777 the whole dang box. I chrooted. Then gave up. :lol: I installed BH9a over the fubared mandrake on the spare partition. Let it install grub. Booted into my BH8, su'ed and fixed it all back to where it was except I have BH9 where I used to have mandrake (no loss)

Somewhere out there is the answer of how to do it with a live CD. I did it on the spare box upstairs. Haven't been able to find it again. I just remember a thread that wasn't about grub lol that had a link to another that was ALL about grub and just this same problem with using the Live CD to fix a hd install.

Anyhow, I am back in business with 2 kanotix's :o the more the merrier, I guess. And windows is now flying. Wow. I gotta admit I am impressed again. I suppose it was about 10 reboots with all the drivers for the various bits and the nic and the printer were a bit of a headache. But it is humming along and I am ready for my games. Linux is better but windows is oooooh so much better for the blood pressure.

markb
10-24-2004, 10:57 PM
I've said it before but I'll say it again. Why don't you guys get rid of all these silly lilo/grub/windows MBR issues and simply install the free "smart boot manager" into your MBR? The whole boot manager fits into the MBR it is not related to any partitions/distributions etc. It is trivially configured entirely by menu and can boot any partition with all the possible options/labels etc you will ever need. Once you do this then you always install your linux lilo/brub into the start of a partition and then all your partitions/installations are completely independent. Keep a copy of it on floppy and you can install in back in a whim if it gets overwritten (e.g. by windows).

See http://btmgr.sourceforge.net/

I've never looked back.

mzilikazi
10-25-2004, 01:44 PM
I've said it before but I'll say it again. Why don't you guys get rid of all these silly lilo/grub/windows MBR issues .

I have never had a problem with GRUB. Besides SBM doesn't even come close to being able to do what GRUB does like boot my remasters for example.

Nishtya - dunno what's wrong but reinstalling GRUB from live cd does work as does su.