Wednesday, December 5, 2007

Grub Recovery

Some times it happens tht ur grub goes down all though u know that the hard drives and the partitions are perfectly ok.

Here is a situation i faced:

Consider a Dual boot machine with 2 OS WinXP (1st) and RHEL (2nd).
Now I had to disect the second partition available to windows into 2 and all linux partitions were after this partition.

Once disected the machine stop booting.
Reason :
Machine was being booted using grub. once I added a partition in between the id (numbering) of original linux partitions shifted ahead by 1. Hence the MBR was unable to find the boot files and got stuck.

To resolve the issue u need to reconfigure grub.

Here is what u do:

  1. use linux cd to boot in rescue mode.
    boot : Linux rescue.
  2. Once booted and the RHEL installations have been found out u get the prompt.
  3. chroot /mnt/sysimage. This changes the root to the / of the installations available.
  4. grub-install /dev/hda or sda or sdb etc. This reconfigures MBR.
Although the MBR is reset but the OS will still not work.
Reason: the partitions given where it needs to find kernel processes are the old ones and hence wrong.

So open grub.conf and change them accordingly.

No comments: