Friday, October 9, 2009

Recovering GRUB after installing Windows...

1) Download Super Grub Disk

2) Burn the image to a blank cd and reboot your machine

3) Boot into your Linux (0.9598 and 0.9799 menu options are slightly different)

4) Once in, open terminal and type
    $ sudo fdisk -l
5) You will see an output like this. For this case /dev/sda4 is my /boot partition
    Device    Boot      Start         End      Blocks   Id  System
    /dev/sda1   *          66        5222    41423602+   7  HPFS/NTFS
    /dev/sda2            5223        6266     8385930   83  Linux
    /dev/sda3            6267       30401   193864387+   5  Extended
    /dev/sda4               1          65      522081   83  Linux
    /dev/sda5            6267        6527     2096451   82  Linux swap / Solaris
    /dev/sda6            6528        9138    20972826   83  Linux
    /dev/sda7            9139       24803   125829081   83  Linux
    /dev/sda8           24804       30401    44965903+  83  Linux

    Partition table entries are not in disk order
6) Mount the partition. Change xxx into your partition number (Since I've already boot into my Linux and /dev/sda4 is mounted to /boot, I'm not sure whether this step is still required)
    $ sudo mount /dev/xxx /mnt
7) Install GRUB to the MBR
    $ sudo grub-install --root-directory=/mnt hd0
If step #6 is not required, I'm assuming the command would be (I need to check this with Ady)
Update 2009/10/13: Step #6 is not required if you booted into your own Linux instead of LiveCD.
    $ sudo grub-install --root-directory=/ hd0
8) I didn't make any changes to my existing /boot/grub/menu.lst file

Note:
Steps tested on my wife's machine with Linux Mint 7 after I'm installing Windows Server 2008. SGD version 0.9598.

An easiest way from Ubuntu wiki
1) Download Super Grub Disk

2) Burn into a cdrom

3) Boot from it

4) Select: GRUB => MBR & !LINUX! (>2) MANUAL |8-)

5) Select the Linux or Grub installation you want to restore.

6) You'll see the message: SGD has done it!

7) Reboot

Note:
I haven't try the second option yet.

No comments:

Post a Comment