Tuesday, October 12, 2010

Reinstall MBR with GRUB stage1

Creating a dual-boot Linux system such as the Red Hat/Debian is a neat way to experiment with both distributions another advantage is  having a fallback point.
A small downside is that the GRUB stage1 information in the MBR can be overwritten by the second install. In our example, Red Hat is installed on the first disk, and Debian is installed on the second. After Debian is installed, however, the Debian GRUB menu is displayed instead of the Red Hat menu that we are used to and that has been customized for our installation.

Let's see how we can solve this issue -

step 1 
Boot to grub CLI

step 2
The root (hd0,0) command sets the (hd0,0) partition as the location of the boot directory. This command tells GRUB in which partition the stage2 and grub.conf or menu.lst files are located.

step 3
The find /boot/grub/stage1 command returned the first stage1 entry it found.
Both disks should have this file. In this instance, GRUB shows the stage1 file from the second disk.Because we want GRUB to format the MBR on the first disk, /dev/hd0 is used.

step 4
The setup (hd0) command writes the MBR of the selected disk or partition.

That's it! The whole process should look like this :

No comments: