grub-install fails on software RAID

Michael Senizaiz trellph at gmail.com
Wed Oct 30 13:47:29 CET 2013


Another post-script I run checks the status of the MD sync.  If the drive
isn't synced the boot sectors may not be on all member disks.  I have a
LAST script that waits for arrays to sync before rebooting (good idea
regardless).

If you have multiple arrays you can loop this.  I actually just have it
copied a few times for the array names we create.

LAST/10-mdsync:

if [ -b /dev/md/0 ]; then
while [[ `mdadm --detail /dev/md/0 |grep -i rebuild |wc -l` -ne 0 ]]
do
   echo "sleeping 30s for resync"
   sleep 30
done
   echo "Synced, continuing"
else
   echo "No RAID, continuing"
fi




On Wed, Oct 30, 2013 at 7:42 AM, Markus Koeberl <markus.koeberl at tugraz.at>wrote:

> On Wednesday 30 October 2013 13:25:59 ol at v-brinkmann.de wrote:
> > Thomas Lange <lange at informatik.uni-koeln.de> hat am 29. Oktober 2013 um
> 22:07 geschrieben:
> > > > < GROOT=$(echo $GROOT | sed 's:md/:md:g')
> > >
> > > I've just read the git log. This minor patch is not needed any more in
> > > wheezy. That's why these lines were removed on Sep 8th. I guess you
> > > still have them in your script.
> >
> > Yes, they are still there. But I don't think they do any harm, as the
> > result of the call
> >
> >     $ROOTCMD grub-probe -tdrive -d $BOOT_DEVICE
> >
> > is "(md0)". It's
> >
> >     $ROOTCMD grub-install --no-floppy "(md0)"
> >
> > that leads to
> >
> >     /usr/sbin/grub-probe: Fehler: no such disk.
> >     Auto-detection of a filesystem of /dev/md0 failed.
> >
> > The same error occurs if I replace "(md0)" with "(hd0)" or "(hd1)", the
> > only entries in /target/boot/grub/device.map.
> >
> > > If you use dracut instead of initramfs-tools you have to add rd.auto
> > > to the kernel command line, otherwise no RAID devices will be
> > > activated by dracut.
> >
> > I did so, but that didn't improve the situation.
> >
> > Olav
>
> I have scripts/GRUB_PC/20-raid in my config space with:
>
> # if raid.
> if [ $(echo $BOOT_DEVICE | grep "/dev/md" >/dev/null; echo $?) == 0 ]; then
>   raiddev=${BOOT_DEVICE#/dev/}
>   #get all member disks
>   for device in `perl -pe 'if(/^'$raiddev'(.*)/){ if(/raid\d+\s(.*)/){
> $var=$1; $var =~ s/\d+\[\d+\]//g; print "$var\n"; } }; $_="";'
> /proc/mdstat`;
> do
>     #install on all member disks
>     $ROOTCMD grub-install --no-floppy "/dev/$device"
>   done
> fi
>
> --
> Markus Koeberl
> Graz University of Technology
> Signal Processing and Speech Communication Laboratory
> E-mail: markus.koeberl at tugraz.at
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.uni-koeln.de/pipermail/linux-fai/attachments/20131030/5a3271c5/attachment.html>


More information about the linux-fai mailing list