Saturday, May 19, 2012

To recover GRUB2 after installing Windows

Your GRUB will be lost after you install Windows.

To recover grub:
1) Boot with Ubuntu live CD

2) open the Terminal. 
    run sudo fdisk -l to see where Linux is installed
    Look for the root partition. Might be like /dev/sda1
   
3) run sudo mount /dev/sdaX /mnt where X is the number you have found.

4) run sudo grub-install --root-directory=/mnt /dev/sda to install grub.
    Note that /dev/sda without a number postfix.
    Reboot it.

5) After re-boot. Run sudo update-grub to update grub.
    This will update GRUB menus to add Windows boot loader.

6) Re-boot again to check that Windows boot loader added in GRUB menus.

Enjoy...