Restore Grub

You’ve decided to build a dual-boot system. You’ve just finished installing Windows XP after your Fedora Core 4 install. By this time, you are probably scratching your head as to what happened to the Linux partition after installing Windows XP. Is it gone?

Well, don’t fret. Your Linux partition is still there. You just can’t get to it. Hopefully, you did not overwrite your Linux partition with the Windows XP install. I’m assuming you didn’t and that you’ve installed Windows XP on a separate partition.

What you need to do next is to restore Grub which gives you a menu selection whether to boot in Linux or Windows XP.

Before we get started, you will need a Fedora Core 4 Rescue CD. You need this to boot in Linux. The Rescue CD comes in handy in the future if you have problems booting from your Linux kernel.

1. Download the ISO image and burn it on the blank CD.
2. Boot from the Fedora Core 4 Rescue CD.

After bootup, press the Enter key to enter the Rescue mode. You will be asked to Choose Language and Keyboard types. Make your selection. The default is “us.” Select No to start the network interfaces. We don’t need the network for this exercise.

3. The rescue CD will look for your system and will tell you where it is located. In my case, it was on /mnt/sysimage.

4. Type the following commands:

#chroot /mnt/sysimage
#grub-install /dev/hdc

There were several documentations online pointing to /dev/hda, but I found mine on /dev/hdc. You can type /sbin/fdisk to view your Linux partitions.

5. Remove the Rescue CD from the CD drive and reboot by typing:

#exit

After reboot, Grub will present you with a menu selection. If the Windows XP selection is missing, you’ll need to add it to the Grub configuration.

From the bash terminal, type in the following commands.

#su
#cd /boot/grub
#vi menu.1st

Login as root. Change directory to /boot/grub. Edit the menu.1st file.

Enter the following lines:

title Windows XP
rootnoverify (hd0,0)
chainloader +1

Save the file and reboot Linux. The Windows XP selection should now appear. If you want Windows to be the default, set it to “default=1″ assuming the second “title” entry is Windows XP. The first title entry is always 0 and the second is 1 and so forth.

That’s it. Enjoy your dual boot system.


One Response to “Restore Grub”

  1. Good tip, especially considering the frequency of reinstalls that Windows usually requires.

    The specific device for your hard drive depends on your IDE configuration. Primary master is /dev/hda, primary slave is /dev/hdb, secondary master is /dev/hdc and secondary slave is /dev/hdd. SATA drives are listed as /dev/sda etc.

Leave a Reply