Categories
Linux

How do I rebuild grub after Windows 8 installation

Recently I had updated my System which was dual booted (Debian and Windows 7) from Windows 7 to Windows 8, During the installation process I had messed up with Grub boot loader. Once after the upgrade my Grub has vanished and I was able to boot up only Windows 8.

A bit disappointed thinking about windows Not giving an option to Select a boot loader of my choice, I started looking back on my System admin skills and finally here’s how I recovered my Boot loader.

1. Boot from a CD or Live USB.

2. Go to Linux rescue.

3. Get the partition tables for the hard disk devices using fdisk command, and find out the linux root file system, in mycase it was /dev/sda6

# fdisk -l

4.  mount the root filesystem using the mount command.

#mkdir       /recover

#mount     /dev/sda6        /recover

5. mount /proc and /dev filesystems

#mount    -t     proc     none       /recover/proc

#mount    -o    bind      /dev      /recover/dev

7. Now chroot to the mounted root filesystem

#chroot     /recover

8. Now do grub-install to reinstall grub

#grub-install  /dev/sda

9. Grub-install finished without error  and I was able to dual boot from Grub after a Reboot.