//home | tags | archives | about | grosu.nl | eulinux.org | RSS Feed

Restoring the MBR on RHEL/CentOS servers

floyd - Mon 16 March 2009 - linux, rescue

It happens that the MBR is getting bad (after os updates/power failures, etc)
We can restore it in a few minutes if we have a RHEL/CentOS install CD at hand, or if we have a PXE server nearby.

Boot the system from the install cd,
at the boot prompt choose:

text rescue

After booting the rescue system, perform the following commands (actually only the chroot and grub-install may be needed, but sometimes the rescue system does not see all devices under the mounted system tree):

chroot /mnt/sysimage
mount -t proc proc /proc
mount -t sysfs sysfs /sys
mount -t tmpfs tmpfs /dev
mkdir dev/pts
mount -t devpts devpts /dev/pts
/sbin/udevstart
/sbin/grub-install hd0
quit
quit

The system will reboot, and hopefully all will work right away.
If it doesn't - you will need to dig further :)
P.S - Don't sue me if these commands do some nasty things to your server ;)