Monday, 20 February 2012

Rescuing Grub

Here is how you  can rescue your grub....


You can use a LiveCD or a USB to boot in rescue mode .... 


In Terminal tpye sudo fdisk -l   .
    It will display all partiton of the disk.

Mount the ubuntu partition drive
       sudo mount /dev/sdXX /mnt  (example 'sudo mount /dev/sda11 /mnt' ,don't miss the spaces.)


Only if you have a separate boot partition:
            sudo mount /dev/sdYY /mnt/boot.
Mount the virtual filesystems:
           
            sudo mount --bind /dev /mnt/dev
            sudo mount --bind /proc /mnt/proc
            sudo mount --bind /sys /mnt/sys


To ensure that only the grub utilities from the LiveCD get executed, mount /usr    
     sudo mount --bind /usr/ /mnt/usr
     sudo chroot /mnt 

If there is no /boot/grub/grub.cfg or it's not correct, create one using
           update-grub
      or  update-grub2
Now reinstall Grub 
         grub-install /dev/sdX  (eg. grub-install  /dev/sdaDo not specify the partition number.  
Verify the install
        sudo grub-install --recheck /dev/sdX
Exit chroot : CTRL-D on keyboard.
Unmount virtual filesystems: 
           sudo umount /mnt/dev
           sudo umount /mnt/proc
           sudo umount /mnt/sys



Unmount the LiveCD's /usr directory:
          sudo umount /mnt/usr

Unmount last device:
           sudo umount /mnt
 Reboot.
         sudo reboot.

No comments:

Post a Comment