Saturday, October 18, 2014

Restore grub2 after install windows

The problem is after you install linux and then you install a windows 

For example after install Ubuntu 9.10 and then I install Windows operating system along with Ubuntu. The windows will override Master Boot Record on Hard driver , so from now when your computer boot up, you only can see Windows.

To solve the problem:

We need to have a CD version of Ubuntu 9.10. Boot our PC with live mode of Ubuntu 9.10
.Open Terminal ( Applications  > Accessories > Terminal)

(We suppose that the Ubuntu already installed on  partition sda3 of sda)

sudo -i (change user to  root user).

mount /dev/sda3 /mnt

grub-install --root-directory=/mnt/ /dev/sda

mount --bind /proc /mnt/proc

mount --bind /dev /mnt/dev

mount --bind /sys /mnt/sys

chroot /mnt update-grub

umount /mnt/sys

umount /mnt/dev

umount /mnt/proc

exit

Reboot your computer and enjoy !