Thursday, June 24, 2010

GRUB 2 recovery

hi

sometime you install windows (or any other operating system) and loose your linux grub
i tell you how to do this with GRUB2

1)Boot from LiveCD Desktop (ubuntu 9.10 or 10.4 or later 32 or 64 bit)
2)Open a terminal by selecting Applications, Accessories, Terminal from the menu bar.
3)Determine the partition with the Ubuntu installation.
        sudo fdisk -l
 
output is omething like this :
 
Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        3225    25904781    7  HPFS/NTFS
/dev/sda2            3226        9730    52244789    f  W95 Ext'd (LBA)
/dev/sda5            3226        6325    24900718+   7  HPFS/NTFS
/dev/sda6            6326        6568     1951866   82  Linux swap / Solaris
/dev/sda7            6569        8028    11720704   83  Linux
/dev/sda8            8028        9730    13670400   83  Linux 

my linux is on sda7 partition 
4)Mount the partition containing the Ubuntu installation.
        sudo mount /dev/sda7   /mnt 
 
5)The below command will reinstall the GRUB 2 files on the 
mounted partition to the proper location and to the MBR of the 
designated device. 
        sudo grub-install  --root-directory=/mnt/    /dev/sda
 
6)Reboot and enjoy
  

No comments: