Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Re-installing GRUB w/out reinstalling Linux

Status
Not open for further replies.

Codename46

IS-IT--Management
Jul 25, 2005
21
US
Hello everyone.

My desktop has three hard drives. One uses NTFS and has Windows XP. One is also NTFS and is used for my data files. My third is an ext3 that has Ubuntu linux on it.

The problem is this: Whenever I reformat my first hard drive and reinstall windows, GRUB stops working (I can understand why) and usually I have to reinstall Ubuntu, wiping out my current linux files as well, in order to solve it.

I was wondering if there was any way to reinstall GRUB without reinstalling linux. Thanks
 
I'm not sure what the command is for Ubuntu (ubuntu recovery maybe?), but you should be able to boot with the Ubuntu installation CD, mount the system & install grub by itself.
 
As root, you can type :
# grub

That should enter the GRUB menu. Then, you can setup GRUB as needed. Here's an example, assuming your boot partition (partition with kernel) is hda1 :

grub> root (hd0,0)
grub> setup (hd0)
grub> quit

"That time in Seattle... was a nightmare. I came out of it dead broke, without a house, without anything except a girlfriend and a knowledge of UNIX."
"Well, that's something," Avi says. "Normally those two are mutually exclusive."
-- Neal Stephenson, "Cryptonomicon"
 
Well my Windows partition is hda and my Linux partition is hdb. Would that have an effect?
 
So :

/boot is in /dev/hdb1 ?
And so /boot/grub etc.

You would do :
# grub
grub> root (hd1,0)
grub> setup (hd0)
grub> quit


For instance.

"That time in Seattle... was a nightmare. I came out of it dead broke, without a house, without anything except a girlfriend and a knowledge of UNIX."
"Well, that's something," Avi says. "Normally those two are mutually exclusive."
-- Neal Stephenson, "Cryptonomicon"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top