PDA

View Full Version : Reinstalling Grub - The Right Way



carney1979
3rd August 2006, 02:31 AM
I have a dual boot system - WinXP (for Flight Simulator) and FC5 for everything else.

Recently, my WinXP side (the dark side) started really acting up, so I reinstalled it from the system disks.

Of course this overwrote the MBR and grub, so I had to boot into FC5 with the "linux rescue" option on the install DVD.

Once there I chrooted into FC5 (chroot /mnt/sysimage) and did a "grub-install /dev/sda".

Windows would no longer boot after that. Dang!

This is how my drive is setup. There is only one 200 GB SATA drive in my computer.

First partition - Windows XP (NTFS)
Second partition - Compaq's rescue partition (FAT32)
The rest - A default FC5 install. I let the FC5 installer partition the rest in it's default manner.

It all worked quite well before I "recovered" my WinXP install.

This is what I did:

1. I recovered my WinXP install. There was a minor error message during the recovery. Sorry, I don't remember what it was. It sounded minor at the moment but in hindsight, it probably wasn't.

2. WITHOUT booting into WinXP, I rebooted and entered the above mentioned "linux rescue" mode and after chrooting as above, I did a "grub-install /dev/sda".

3. As I had a good FC5 install with a grub.conf that worked perfectly with the same whole setup before, I figured no further adjustment was needed. I rebooted and tried to boot into WinXP from grub. I got a "Cannot find NTLDR" error and it all stopped. A later check from FC5 with "fdisk -l" confirmed the WinXP and Compaq rescue partitions to be in their original places as before the "recovery".

4. I hit ctrl-alt-delete and this time I selected my FC5 install. It booted fine.

5. Rebooted again and tried to boot into WinXP again with the same results as above.

Now my assumption is I did it all right, but the WinXP recovery went really wrong and that's why it wouldn't boot into WinXP. But just in case I did make a really critical error, I wanted to pass it by you experts to see if you see anything I did wrong (besides keeping WinXP on my computer).

Thanks in advance for any help or advice!

David

rappermas
3rd August 2006, 03:40 AM
Cannot find NTLDR. NTLDR is the windows NT series bootloader--it boots Windows NT, Windows 2000, and Windows XP. Windows XP installed NTLDR onto the Master Boot Record (MBR). Then you came along and replaced it with GRUB.

Here, try this. Pop in your XP disc and get to the recovery console. After entering the administrator password for it, type in



fixmbr


That will write NTLDR to the MBR. See if XP boots. If it does, go into Linux recovery and install GRUB on the MBR and you should be set.

carney1979
3rd August 2006, 05:33 AM
Sorry. Should have been a bit more specific.

I did successfully recover WinXP on a second attempt. It boots fine.

I just want to make sure my way of reinstalling grub is the right way. I don't want to have to recover WinXP AGAIN.

Thanks.

David

sailor
3rd August 2006, 03:14 PM
THis is what I use:

To re-install Grub:

1. Boot off the 1st Fedora CD or use the Fedora Rescue CD
2. At the boot prompt type 'linux rescue'
3. The rescue mode will find the fedora installation
4. Type 'chroot /mnt/sysimage'
5. Type 'grub-install /dev/hda' (to install Grub to the MBR of the 1st HD)"
6. Re-boot and your grub should be back..:)