Monday, 28 November 2011

Restoring GRUB

Restoring GRUB on Ubuntu

How many times have you lost your GRUB after installing Windows on a system that has Ubuntu (or any other distro) already installed?

The bootloader sector of the hard disk stores the information about all the operating systems installed on your system. When you install Linux, it probes for any existing operating system and adds an entry in the GRUB list. On the other hand, when you install Windows, it overwrites the bootloader and erases all the entries, leaving no way to access your Linux.

To restore GRUB, you will need Ubuntu mounted on any removable drive (CD/DVD/Pen drive) will can be used as a live CD. After booting from the external media, select "Use as Live CD" option. Open the terminal and type the following commands:

Also, you should know where you have installed Ubuntu (in this example sda3)

~$ su # mount /dev/sda3 /mnt
# mount --bind /dev /mnt/dev
# mount --bind /proc /mnt/proc
# mount --bind /sys /mnt/sys
# chroot /mnt
# grub-install /dev/sda

Close the terminal and reboot. Your GRUB should be restored.

No comments:

Post a Comment