Reinstalling GRUB

Sando

Distinguished
Mar 28, 2006
9
0
18,510
Hi,

A while back I put a copy of Ubuntu on a free partition in my main windows box, worked fine for a while, and loaded GRUB to let me choose which OS to boot into. Then I had to reinstall Windows (can't remember why - I'm too experimental and occasionally break software rather badly) but predictable (in hindsight) this overwrote GRUB in the boot sector.

What I want to know is - If I reinstall GRUB, will it find all the OS's by itself, or will I have to spend ages fixing it so I can boot into everything I could before?

Also, should be installing GRUB Legacy or GRUB 2. And how hard will it be?

Any help much appreciated.
 

linux_0

Splendid
Hi,

A while back I put a copy of Ubuntu on a free partition in my main windows box, worked fine for a while, and loaded GRUB to let me choose which OS to boot into. Then I had to reinstall Windows (can't remember why - I'm too experimental and occasionally break software rather badly) but predictable (in hindsight) this overwrote GRUB in the boot sector.

What I want to know is - If I reinstall GRUB, will it find all the OS's by itself, or will I have to spend ages fixing it so I can boot into everything I could before?

Also, should be installing GRUB Legacy or GRUB 2. And how hard will it be?

Any help much appreciated.




0. Boot from the Ubuntu CD ( rescue mode ).

1. get to the CLI ( command prompt ).

2. /sbin/grub-install /dev/sda

On a RedHat'ish system you would run this:


/sbin/grub-install --root-directory=/mnt/sysimage --grub-shell=/mnt/sysimage/sbin/grub --recheck /dev/sda


On Ubuntu it will be a little different depending on where your Ubuntu root partition is mounted when you boot up from the install CD


/sbin/grub-install --root-directory=/your_root_drive --grub-shell=/your_root_drive/sbin/grub --recheck /dev/sda



Replace /dev/sda with the appropriate device for your primary hard drive

/dev/hda = primary master PATA IDE
/dev/hdb = primary slave PATA IDE
/dev/hdc = secondary master PATA IDE
/dev/hdd = secondary slave PATA IDE

/dev/sda = 1st SCSI or SATA IDE drive
/dev/sdb = 2nd SCSI or SATA IDE drive
.
.
.
/dev/sdz = 26th SCSI or SATA IDE drive


If this does not work you can fix it using the Ubuntu CD or virtually any Linux Live CD or DVD or any rescue CD from any distro.


GL :-D