Sunday 19 April 2015

How to recover GRUB after Microsoft Windows Installation ?


I have been asked so many times by the linux newbies "How to recover GRUB after installing XP or windows 7 ?".

To make the Linux booting after installing windows on the other partition, we need to re-install the GRUB again. You need a Ubuntu bootable pendrive or live CD for this purpose. Boot your system with this pendrive or live CD. Open command line terminal (Application-> Accessories-> Terminal). I am assuming that windows is on first partition and Linux's "/" on second partition. Run the following command.
$ sudo mount /dev/sda2 /mnt
$ sudo grub-install --root-directory=/mnt /dev/sda

The above commands will install GRUB. Now boot your system with the HardDisk. When the system is booted up open the terminal and run the following command.
$ sudo update-grub2
The above command will add an entry for windows  operating system in the grub config file