Search This Blog

Friday, January 18, 2013

Restore/Reinstall Grub 2 in Ubuntu

  1. Change your system boot priority to CD drive \ USB [depends on your installation media... I selected USB].
  2. Select option Run Ubuntu from this USB.
  3. Open the Terminal and run below command to find the partition where Ubuntu Installed.
    1. sudo fdisk -l [In my system on sda8]
Sample output is:

 Device Boot      Start         End      Blocks   Id  System
/dev/sda1              63       80324       40131   de  Dell Utility
Partition 1 does not start on physical sector boundary.
/dev/sda2   *       81920    31145983    15532032    7  HPFS/NTFS/exFAT
/dev/sda3        31145984   197792279    83323148    7  HPFS/NTFS/exFAT
/dev/sda4       197792280   625141759   213674740    f  W95 Ext'd (LBA)
/dev/sda5       197792343   354474224    78340941    7  HPFS/NTFS/exFAT
Partition 5 does not start on physical sector boundary.
/dev/sda6       354474288   438606629    42066171    7  HPFS/NTFS/exFAT
/dev/sda7       438606693   522739034    42066171    7  HPFS/NTFS/exFAT
Partition 7 does not start on physical sector boundary.
/dev/sda8       522739712   613423103    45341696   83  Linux
/dev/sda9       613425152   625141759     5858304   82  Linux swap / Solaris

  • Execute following 15 commands one by one, then restart your system and revert back the boot priority.
    1. sudo mount /dev/sda8 /mnt
    2. sudo mount --bind /dev /mnt/dev
    3. sudo mount --bind /dev/pts /mnt/dev/pts
    4. sudo mount --bind /proc /mnt/proc
    5. sudo mount --bind /sys /mnt/sys
    6. sudo chroot /mnt
    7. grub-install /dev/sda
    8. grub-install --recheck /dev/sda
    9. update-grub
    10. exit
    11. sudo umount /mnt/dev/pts
    12. sudo umount /mnt/dev
    13. sudo umount /mnt/proc
    14. sudo umount /mnt/sys
    15. sudo umount /mnt

      No comments: