Comment 34 for bug 33649

Revision history for this message
Dustin Kirkland  (kirkland) wrote :

Colin-

I have a proposed patch in a bzr branch of grub:
 * https://code.launchpad.net/~kirkland/grub/33649

The first patch handled grub-installer used in the debian-installer, and this one handles grub-install (in the grub package), used in the installed operating system thereafter.

The grub-install_better_raid.diff patch basically reverts the raid.diff patch, replacing the (somewhat convoluted) getraid_mdadm() function with a far simpler algorithm matching that which we use in grub-installer.

Additionally, this patch adds support to detect if /boot is on a RAID device, and if so, we will iterate over each hard disk in the RAID providing /boot, installing GRUB to the MBR. I tried to match the logic and syntax used in grub-installer as identically as possible.

If you have a /dev/md0 RAID, providing your root filesystem, consisting of /dev/sda1 and /dev/sdb1, using this patch, you can run any of:
 # grub-install /dev/md0
 # grub-install /dev/sda
 # grub-install /dev/sdb
 # grub-install /dev/sda1
 # grub-install /dev/sdb1
And GRUB will be installed into the MBR of both /dev/sda and /dev/sdb.

The output of grub-install looks like this:

root@ubuntu:~# grub-install /dev/md0
Searching for GRUB installation directory ... found: /boot/grub
Installing GRUB to /dev/sda
Installing GRUB to /dev/sdb
Installation finished. No error reported.
This is the contents of the device map /boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.

(hd0) /dev/sda

:-Dustin