Please note that this guide tells you how to recover previously installed GRUB and reconfigure it. But, it does not tell you how to reinstall fresh copy of GRUB.
My laptop came installed with Windows Vista. I then installed Fedora 14 in another drive. However, I installed Windows 7 over Vista (fresh install, not an upgrade). So, Windows installed its own bootloader and grub was gone. So, I could not boot fedora because Windows bootloader could not identify Fedora. So, I had to reinstall grub using the Fedora LiveCD ISO image I had.
Creating Bootable Fedora Live USB from ISO Image
Well, it is an easy task that you can just burn the Fedora live ISO to a CD and then boot from it. But if you do not want to waste a CD or do not have a CD writer, make a bootable USB. Just download the Linux Live USB Creator and use it to create a bootable Live USB of your pen drive from the Fedora Live ISO that you have.
Now boot using your Live USB and login using the automatic login option. Then open a terminal and type:
Now, check the volume in which your linux was previously installed and its format. For this, just run the option of intalling Fedora to hard drive from the desktop. Proceed to the step that asks hard disk layout. Choose the option of custom layout. Look for the drive that has ext1 or ext2, or ext3 or ext4 etc file system on it. Mine was /dev/sda2 and the file system was ext4. Also, notice the top drive label, that represents your complete hard disk (we will need it later). Mine was /dev/sda. So, I typed:
mount -t ext4 /dev/sda2 /mnt/root
You replace ext4 with your linux file system and /dev/sda2 with the linux volume on your hard drive.
Then mount the proc subsystem and udev:
mount -t proc none /mnt/root/proc
mount -o bind /dev /mnt/root/dev
Now change the root directory:
chroot /mnt/root /bin/bash
Finally, install grub to your harddisk:
Replace /dev/sda with your hard disk label as we noticed earlier.
Now reboot your system and you will see grub again.
Change the menu that GRUB displays
The above procedure simply reinstalls the GRUB you had previously installed. But, if you have installed a new version of Windows or did not have Windows installed at the time you installed Linux, windows option will not show in GRUB. To correct this problem, boot into your Linux, open a terminal and type:
Now, add these lines to the end of grub.conf and save:
title Microsoft Windows 7
Change the title to the version of Windows as you desire. Also, replace (hd0, 0) by (hd0, x) where x is the partition number on which Windows is installed. E.g. if Windows is installed on /dev/sda3, then change it to (hd0, 2) because (hd0, 0) represents /dev/sda1.
Thats all. Please comment back for your views and suggestions.