Re-Install GRUB2 After Windows 7 Reinstallation (Dual-Boot)

Posted August 09 by GreenCloud

Scenario: You have a dual-boot setup (Windows 7 + Ubuntu 10.04LTS). But your Windows 7 crashed and you decided to make a fresh install. After reinstalling Windows, Ubuntu is gone and boot up gets you straight to your Windows installation. And GRUB2, which supposed to manage these 2 operating systems, is nowhere to be found, or worst, the screen might only show you a “grub_rescue>” black screen of death.

Well, chill out, this is a very simple issue and I have a very simple, but effective solution for you.

Simply grab your Ubuntu 10.04LTS Live-CD and run it. Once you’re on the desktop  go to Applications -> Accessories -> Terminal and then follow these simple steps.

1. First, you need to find out the UUID of the partition that should contain your boot loader. In my case it’s located in my root directory (/). To do that simply type:

$ sudo fdisk -l

In my machine the command resulted in something like this:

 

Device Boot      Start      End     Blocks   Id  System
/dev/sdb2        321        5589    42312704   83  Linux
/dev/sdb3        5589       9730    33262592   83  Linux
/dev/sdb4        14         320     2465977+  82  Linux swap / Solaris

To confirm your boot loader location, in the Terminal, simply type:

$ df -Th

And the result looks something like this:

Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/sdb2     ext4     40G  6.4G   32G  17% /
/dev/sda5  fuseblk    175G  151G   24G  87% /media/wintfs
/dev/sda1  fuseblk     59G   33G   27G  55% /media/winboot
/dev/sdb3     ext4     32G   14G   16G  48% /home

2. Now to prepare this partition (/dev/sdb2) for GRUB install, first we need to mount it

$ sudo mount /dev/sdb2 /mnt

If you have a different location for your boot loader e.g. /boot instead of just root (/), try it like this:

$ sudo mount /dev/sdb2 /mnt/boot

3. Now you can install GRUB2 in your boot loader partition:

$ sudo grub-install --root-directory=/mnt /dev/sdb

(Notice the partition UID number (2) has been excluded)

Again, if you have a different location for your boot loader, try:

$ sudo grub-install --root-directory=/mnt/boot /dev/sdb

4. After you have successfully installed GRUB, unmount your boot partition:

$ sudo umount /mnt

or

$ sudo umount /mnt/boot

5. Reboot your computer.

For more information about GRUB, please click here.

.


Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>