I am using a software RAID 1 (mirror) on two drives and the first drive has failed or been physically removed. When trying to make the second drive bootable, grub-install fails telling me '/dev/hdx does not have any corresponding BIOS drive.' How can ...

Updated

I am using a software RAID 1 (mirror) on two drives and the first drive has failed or been physically removed. When trying to make the second drive bootable, grub-install fails telling me '/dev/hdx does not have any corresponding BIOS drive.' How can I make this drive bootable with GRUB?

Release Found: Red Hat Enterprise Linux 3

Symptom:

When the first disk of a software RAID has been removed, the second drive is not bootable. Performing a grub-install fails with the error message: '/dev/hdx does not have any corresponding BIOS drive'.

Solution:

Please note that before performing any of these steps, you should have a recent backup of your important data. If for any reason the primary drive becomes unbootable, you should have your Red Hat Enterprise Linux CD #1 available in order to load the rescue environment.

If you are attempting to run grub-install inside of a rescue environment, you will need to first manually mount the corresponding disk partitions. You can view the partitions with the command:

# fdisk -l

You need to mount any partitions of type Linux or Linux RAID autodetect. In the following example of fdisk output, the /boot partition is /dev/hda1 and the / partition is /dev/hda2:

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1             1        13    104391   fd  Linux raid autodetect
/dev/hda2            14      1288  10241437+  fd  Linux raid autodetect
/dev/hda3          1289      1352    514080   82  Linux swap

In this example, you would mount the partitions and chroot using the following commands:

# mkdir /mnt/sysimage
# mount /dev/hda2 /mnt/sysimage
# mount /dev/hda1 /mnt/sysimage/boot
# chroot /mnt/sysimage

The next step is to edit the file /etc/grub.conf (which is a symbolic link to /boot/grub/grub.conf). Uncomment the following line by removing the pound sign (#) at the beginning of the line:

from:
#boot=/dev/hda

to:
boot=/dev/hda

Now, to make the drive bootable, GRUB must be installed to the master boot record (MBR) of the disk. To do this, execute the following command (as root) to enter a GRUB shell:

# grub --batch --device-map=/boot/grub/device.map
    --config-file=/boot/grub/grub.conf --no-floppy

Now, from the GRUB shell prompt, execute the following commands:

grub> root (hd0,0)

grub> setup (hd0)

grub> quit

The setup command within this shell actually writes GRUB to the MBR, which makes the drive bootable.

Components
Article Type