Restore GRUB bootloader after Windows installation on multi-boot system

Windows operating systems have the habit of installing their own bootloader on every installation - this wouldn't be a problem, if they would recognize all present operating systems. But unfortunately, they only recognize other Windows systems.

Apart from installing EasyBCD and other tools on your Windows partition to set things right, you can also just reinstall the lost GRUB boot manager with the help of a live CD (I used Ubuntu 11.10 for that). Insert the CD and boot from it. Open a terminal. If you have no idea what the name of your partitions is, use

fdisk -l

to get an overview. My output looks like this:

christian-main christian # fdisk -l
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000587d5
.
Device Boot Start End Blocks Id System
/dev/sda1 63 629147647 314573792+ 83 Linux
/dev/sda2 * 629147648 775948287 73400320 7 HPFS/NTFS/exFAT
/dev/sda3 775948288 968380415 96216064 7 HPFS/NTFS/exFAT
/dev/sda4 968382196 976768064 4192934+ 5 Extended
/dev/sda5 968382198 976768064 4192933+ 82 Linux swap / Solaris
christian-main christian #

My first partition, /dev/sda1, has Linux installed and is the partition I want to have GRUB on - what I need is its identifier, sda1. Replace every following instance of that identifier with the one of your partition's identifier. Become root by typing

sudo -i

Afterwards mount your partition and install grub (replace sda1):

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

If there is no grub.cfg in /boot/grub, create one using

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

Afterwards you can restart your system, remove the Live CD and boot into GRUB.

Leave a Comment