# Recover GRUB after Windows reinstall...



## saurabh.sauron (Sep 20, 2006)

The Master Boot Record is erased after a Windows reinstall on a dual-boot. this is the method to recover GRUB in ubuntu and fedora core...

Fedora Core

Boot with a live cd that has grub. Issue these: 
logon as root/type su in the terminal/konsole 



> grub (enter)





> root (hd0,?)



(? being where your controlling distro is)


> setup (hd0)



Alternative method 

login as root/use su 



> grub-install /dev/hda




and then it will tell you that the installation is completed witout errors and you can reboot your machine 

it can be done by any of the above methods.


Ubuntu

1.)Boot from the Live CD. 
2.)Open the terminal. Quote:


> sudo grub



this opens the grub prompt 



> find /boot/grub/stage1



this command gives a location (or two) 



> root (hdx,y)


this will inform u about the partition type



> setup (hdx,y)



where x and y refer to the locations returned by the find command 
restart and then GRUB should be there.

Source:- In a linux book


----------



## Vishal Gupta (Sep 20, 2006)

good one buddy  
It'll really help ppl, who face this problem after installing windows over linux.


----------



## mak1012 (Mar 28, 2009)

Hi,
 My problem is I have two hard drive in one xp and in another fedora, I can boot in both but by setting HD preference in BIOS, I wanna add xp in my grub How do go about this. My grub config look like this 

```
#boot=/dev/sda
default=0
timeout=10
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
[B][B]title Windows XP
               map (hd0) (hd1)
               map (hd1) (hd0)
               rootnoverify (hd1,0)
               chainloader +1[/B][/B]

title Fedora (2.6.27.5-117.fc10.i686)
	root (hd0,0)
	kernel /boot/vmlinuz-2.6.27.5-117.fc10.i686 ro root=UUID=f26ce451-55a5-4c4d-90b7-c6122bace99f rhgb quiet
	initrd /boot/initrd-2.6.27.5-117.fc10.i686.img
title Other
	rootnoverify (hd0,4)
	chainloader +1
```

the text in bold I added to do but its not working at all.  Please help.


----------



## vamsi360 (Mar 29, 2009)

what is the partition number alloted to your 2nd hdd?


----------

