Installing GRUB on all disks of a software RAID 1

Summary

In August 2010 Manuel Schmitt reminds readers that with Linux software RAID 1 the GRUB bootloader must be set up on every disk so that the system still boots after one drive fails completely. The guide from an internal list enters every disk as hd0 in device.map and runs setup for each drive in the GRUB shell. The background is that the numbering changes when booting with a missing drive, but an hd0 is always present.

GRUB Legacy and GRUB 2

The root and setup commands described belong to GRUB Legacy. According to the GRUB manual, its last version 0.97 was released in 2005, and by the end of 2009 several major distributions were already installing GRUB 2 by default.

GRUB 2 uses UUIDs or file system labels in grub.cfg instead of fixed device numbers. The manual therefore describes device.map as needed only in special cases, because Linux device names can change from boot to boot. The basic problem remains, though: the bootloader code in the boot sector is written per disk, with GRUB 2 by running grub-install for each disk.

Ideas

  • A RAID 1 does not automatically protect against a missing bootloader.
  • When a drive fails, the BIOS or GRUB numbering can change.
  • device.map maps several physical disks so that GRUB can treat each as hd0.
  • setup must write the bootloader to every mirrored disk.
  • GRUB 2 avoids fixed device numbers through UUIDs and labels.

Insights

  • Data redundancy without a tested boot path only produces a partly highly available machine.
  • A real failure test finds boot problems that a healthy RAID never shows.

Facts

  • The guide enters /dev/sda, /dev/sdb and further disks each as (hd0) in device.map.
  • The GRUB shell runs setup for every drive.
  • The last version of GRUB Legacy, 0.97, was released in 2005.
  • According to the GRUB manual, several major distributions installed GRUB 2 by default by the end of 2009.

References

Recommendations

  • Install the bootloader on all mirrored disks, with GRUB 2 via grub-install per disk.
  • Test every disk on its own as the only remaining boot drive.
  • Repeat the bootloader installation after every disk replacement.

Read the original article on Hostblogger

Search the Web Archive

Found a mistake or have something to add? Get in touch.