After reinstalling Windows in the computer dual boot with both Windows and Ubuntu Linux,you need restore grub because mbr has been rewritten.This tutorial shows how to restore grub 2.

1).Using Grub4Dos

First download grub4dos from here.

a). For XP user,copy the file “grldr”(without quotes) from grub4dos package to C:\.Edit boot.ini (hidden file in C:\) and add this line to the file:


For Vista/win7 user,copy the file “grldr”,”grldr.mbr” to C:\.Create boot.ini file in the root directory of C:,copy and paste following into this file.

[boot loader]
[operating systems]

b). Now,create menu.lst in root directory of C:,its content:

timeout 0
default 0
title grub2
find --set-root /boot/grub/core.img
kernel /boot/grub/core.img

Restart computer,and select boot from Grub4Dos.Then select boot up Ubuntu in grub menu.
Once login,use this command to install grub into mbr:

sudo grub-install /dev/sda

2).Using Ubuntu 9.10 LiveCD or Higher

Here assuming the Ubuntu partition is sda7,and /boot partition is sda6 (if you have a separate /boot partition).
Boot up ubuntu from the livecd,open terminal and run:

sudo -i
mount /dev/sda7 /mnt
mount /dev/sda6 /mnt/boot #skip this one if not have a separate /boot partition
grub-install --root-directory=/mnt/ /dev/sda

If you miss “grub.cfg” file,use following to recreate:

mount --bind /proc /mnt/proc
mount --bind /dev /mnt/dev
mount --bind /sys /mnt/sys
chroot /mnt update-grub
umount /mnt/sys
umount /mnt/dev
umount /mnt/proc

3).Using the CD/USB boot up with grub

Boot up the cd/usb,press c in grub menu.Type:

grub>find /boot/grub/core.img
grub>root (hdx,y) (previous command will output the x,y)
grub>kernel /boot/grub/core.img

After the boot command,you’ll go into grub2 menu.Select to boot up ubuntu,and run this command to restore grub:

sudo grub-install /dev/sda