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
- Methode1
Use the following commands:
grub>find /boot/grub/core.img
grub>root (hdx,y) (previous command will output the x,y)
grub>kernel /boot/grub/core.img
grub>boot
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
-
Mothode2
You need to have an Ubuntu LiveCD, Start with LiveCD
under root, check your Linux partition
fdisk -l
example output for Linux partition7
/dev/sda7 7300 7919 8880278+ 83 Linux
sudo mkdir mnt1
sudo mount /dev/sda7 mnt1
followed by:
sudo grub-install --root-directory=/mnt/ /dev/sda
Where is your root directory mounted? Is it /mnt? That’s not where you mounted it just now…
sudo grub-install --root-directory=/media/mnt1 /dev/sda
-
Methode3
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