How to reinstall grub on MBR ?

Rating: +3


Positive


Negative

If you by chance overwrite your MBR (MASTER BOOT RECORD ) or if it turns
corrupt than you can easily recover it using the 1st installation CD of
your RHEL / Fedora Core / CentOS distribution

1) Boot from the 1st CD and type linux rescue as the kernel

It will drop you in a shell with chrooted environment

2) type grub to get the grub prompt
and set the root device to the partition containing your boot directory

e.g. if your boot directory is on /dev/sda2
than type

grub > root (hd0, 1)

you can also use the find command to find the partition where the boot
directory lies

just issue the following at grub prompt

grub> find /boot/grub/stage1

the output will provide the derive that contains the boot directory

3) at Grub prompt type setup (hd0) to install grub at MBR and reboot the
system without the rescue CD

Remember that if you want to install grub on a partition other than the
MBR than you only need to change the last setup

i.e. in setup command you also need to specify the partition

e..g. setup (hd0,1) will install grub on the 2nd partition

Post a Answer