Subscribe Rss:


Sunday, November 18, 2007

How to restore GRUB -II

You have windows ME and Red Hat Linux 8.0 with ext3 filesystem on the same hard disk.
But you bought a brand new bigger hard disk and used Norton Ghost to copy the partitions to the new disk. The problem is that when you boot, you could not see the grub menu :[

To repair it:
If you didn't create the boot disk, boot with the Red Hat Linux CD number 1 and choose rescue mode typing:
linux rescue
Now you need to repair the ext3 filesystem because now it's bigger than before and the journal file must be created again

First, check the filesystem:

fsck.ext3 /dev/hda2

Now, create again the journaling ext3 file:

tune2fs -j /dev/hda2/

Now mount the root filesystem on /mnt/sysimage and run grub

mount -t ext2 /dev/hda2 /mnt/sysimage
cd /mnt/sysimage
cd sbin

Once started, GRUB will show the command line interface. First, set the GRUB's root device1 to the boot directory, like this:
grub> root (hd0,1)
If you are not sure which partition actually holds these files, use the command find, like this:
grub> find /boot/grub/stage1
This will search for the file name /boot/grub/stage1 and show the devices which contain the file.

If you are using a separate /boot partition, as the official documentation says:
"... if you have the partition /boot and you install GRUB images into the directory /boot/grub, GRUB recognizes that the images lies under the directory /grub but not /boot/grub"
Then if 'find /boot/grub/stage1' does not find the file, try 'find /grub/stage1'

Once you've set the root device correctly, run the command setup:
grub> setup (hd0)
This command will install GRUB on the MBR in the first drive.