22 Jan 2013

How to recover deleted or corrupted Grub2 bootloader

Here's a scenario, You reinstalled Windows on your dual booting PC and it replaced Grub2 with it's own bootloader and now you can't boot into your Linux. Or your Grub2 for some reason or other got corrupted and you are unable to boot your operating systems.

grub2 on Twitpic

Well worry not cause it's relatively easy to fix this problem.
All we'll need is a Live CD of any Linux Distro. Boot the CD and once you are running the live environment open the Terminal Emulator and execute the following commands. Replace the 'sda1' in the article with the partition where your Linux is installed. You will also have to change 'sda' with your hard disk.
Command 'fdisk -l' will give you all the info regarding your hdd and partitions.
Okay then lets recover Grub2
mount /dev/sda1 /mnt
mount --bind /dev /mnt/dev
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
chroot  /mnt
grub-install /dev/sda
umount /mnt
That's it! On reboot you'll have good old grub menu to greet you!!! Cheers!!!

No comments: