Question: How to restore Grub 2 after reinstalling Windows XP/Vista/Win7 ?
Answer: There is two ways to restore the grub2 on MBR after reinstalling windows
Use the following commands:
grub>root (hdx,y) (previous command will output the x,y)
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
You need to have an Ubuntu LiveCD, Start with LiveCD
under root, check your Linux partition
example output for Linux partition7
/dev/sda7 7300 7919 8880278+ 83 Linux
Where is your root directory mounted? Is it /mnt? That’s not where you mounted it just now…
It’s possible to do grub2/burg recovery & configuration using a live cd by installing Grub Customizer at the live system. All the file systems you need will be automatically mounted after choosing the root partition and some sub partitions on the “live cd setup assistant” (a dialog which pops up, when you start Grub Customizer inside a live system).*
You can install Grub customizer using the following PPA:
sudo add-apt-repository ppa:danielrichter2007/grub-customizer
sudo apt-get update
sudo apt-get install grub-customizer