At home I have two OS on same Hard Disk, Ubuntu and Windows XP. Due to some reason I have to re-install Windows XP yesterday. After that windows has written it’s own boot loader. So I have to recover Grub to boot Ubuntu. I have tried update-grub but it did not helped me.

So I have to install grub on my hard disk for smooth working. For the same I have used Ubuntu’s bootable media.

Here is my Hard Disk partition table

Disk /dev/sdb: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 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: 0x0005f68f
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1        2677    21502971    7  HPFS/NTFS
/dev/sdb2            2678        4589    15358108+   7  HPFS/NTFS
/dev/sdb3            4590        9567    39980032   83  Linux
/dev/sdb4            9567        9730     1314211+   f  W95 Ext'd (LBA)
/dev/sdb5            9567        9730     1307640   82  Linux swap / Solaris

Windows XP is installed on /dev/sdb1 and Ubuntu installed on /dev/sdb3 (I am not having seperate boot partition).
To install grub2 again on /dev/sdb, I did

mkdir /media/sdb3 
mount /dev/sdb3 /media/sdb3
sudo grub-install --boot-directory=/media/sdb3/boot /dev/sdb --recheck

Please Note if you are having boot partition of different drive then follow below method:
Boot partition on /dev/sdb3
Root partition on /dev/sdb4

So,

mkdir /media/sdb4
mount /dev/sdb4 /media/sdb4
mount /dev/sdb3 /media/sdb4/boot
sudo grub-install --boot-directory=/media/sdb4/boot /dev/sdb --recheck

After that restart your machine. YOu can able to boot in Ubuntu but due to uid update I am unable to boot to windows. So I boot in to Ubuntu and run,

sudo update-grub2

That’s it. Now I am able to boot into Windows XP and Ubuntu

Recovering Ubuntu After Re-Installing Windows

Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Recommend on Google