grub-install fails on software RAID

Thomas Lange lange at informatik.uni-koeln.de
Fri Nov 15 16:25:08 CET 2013


>>>>> On Wed, 30 Oct 2013 13:42:29 +0100, Markus Koeberl <markus.koeberl at tugraz.at> said:

    > I have scripts/GRUB_PC/20-raid in my config space with:
Thanks Markus,
it's a great idea to parse mdstat for getting the list of disks. I
modified your code and now I use this for installing grub onto all
disks. I just used this for a RAID1 on 4 disks. Works perfectly.
This is what I now added to GRUB_PC/10-setup:


# check if mdadm has been forgotten
if [ -f /proc/mdstat -a ! -d $target/etc/mdadm ]; then
    echo WARNING: Found Software RAID, but mdadm was not installed
fi

# Check if RAID is used for the boot device
if [[ $BOOT_DEVICE =~ '/dev/md' ]]; then
    raiddev=${BOOT_DEVICE#/dev/}
    # install grub on all members of RAID
    for device in `perl -ne 'if(/^'$raiddev'\s.+raid\d+\s(.+)/){ $_=$1; s/\d+\[\d+\]//g; print }' /proc/mdstat`; do
        echo Install grub on /dev/$device
        $ROOTCMD grub-install --no-floppy "/dev/$device"
    done
fi

-- 
regards Thomas


More information about the linux-fai mailing list