Howto Recover Grub2 After Windows Installation

Here is the step by step guide to recover Grub2 after windows Installation on your PC or Laptop. First thing u need a liveCD or LiveUSB of Linux, in this case i use Ubuntu Lucid Lynx (10.04).





Step 1
Boot from LiveCD and Make sure your harddrive partitions, you can use terminal command

Code:
~$ sudo fdisk -l
It will show like below (may be different with yours):


Code:
Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x9cb76562

Device   Boot Start  End   Blocks    Id  System
/dev/sda1     1      5    40131      de  Dell Utility
/dev/sda2 *   6     4574  36700492+   7  HPFS/NTFS
/dev/sda3    4575   12407 62918572+  af  HFS / HFS+
/dev/sda4    12408  38913 212909414+  5  Extended
/dev/sda5    12408  15670 26210016   83  Linux
/dev/sda6    15671  19586 31455238+  83  Linux
/dev/sda7    19587  25460 47182873+   7  HPFS/NTFS
/dev/sda8    25461  38906 108004963+  7  HPFS/NTFS
/dev/sda9    38907  38913 56196      82  Linux swap / Solaris
In this case I will recover my Ubuntu Linux Lucid Lynx (10.04) in /dev/sda5 partition, so what i have to do is :

Step 2
Become root and then mount partition on /mnt so open terminal and type
Code:
~$ sudo -i
~# mount /dev/sda5 /mnt

Step 3
Install new grub loader on /dev/sda, type
Code:
~# grub-install --root-directory=/mnt/ /dev/sda

Step 4
Mount Linux partition on /mnt
Code:
~# mount --bind /proc /mnt/proc
~# mount --bind /dev /mnt/dev
~# mount --bind /sys /mnt/sys

Step 5
Change terminal to root on Linux Harddrive (Chroot environment) then update grub loader
Code:
~# chroot /mnt update-grub

Step 6
Umount /proc /dev and /sys
Code:
~# umount /mnt/sys
~# umount /mnt/dev
~# umount /mnt/proc

Step 7
Exit Chroot environment
Code:
~# exit

Now you can reboot and then your loader will be back, so you can enter to your favourite linux

0 Comment:

Post a Comment