Omnipresent IT Solutions Pvt Ltd

Wednesday, August 5, 2009

How to restore GRUB menu after Windows installation



How to restore GRUB menu after Windows installation

  1. Boot from the CD/DVD and at the boot prompt type: linux rescue.
  2. Select your language and keyboard layout.
  3. Choose whether or not to start networking interfaces.
  4. Mount your partitions read/write.
  5. Type chroot /mnt/sysimage to enter your Linux environment.
  6. Type grub-install /dev/sda or grub-install /dev/hda
  7. Reboot.

To add Windows entry into GRUB menu

Take a backup first
cp /boot/grub/menu.lst /boot/grub/menu.lst_backup

Edit the file and add following line at the end of file
/boot/grub/menu.lst

#windows
title Microsoft Windows
root (hd0,0)
savedefault
makeactive
chainloader +1


A sample menu.lst file

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,1)
# kernel /vmlinuz-version ro root=/dev/mapper/vg_acerfedora-lv_root
# initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=15
splashimage=(hd0,1)/grub/splash.xpm.gz
#hiddenmenu
title Fedora (2.6.29.6-217.2.3.fc11.i686.PAE)
root (hd0,1)
kernel /vmlinuz-2.6.29.6-217.2.3.fc11.i686.PAE ro root=/dev/mapper/vg_acerfedora-lv_root quiet
initrd /initrd-2.6.29.6-217.2.3.fc11.i686.PAE.img
title WindowsVista
rootnoverify (hd0,0)
chainloader +1

Note:You can change timeout,default values by editing this file.

No comments: