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 <[email protected]>wrote: > On Wednesday 30 October 2013 13:25:59 [email protected] wrote: > > Thomas Lange <[email protected]> 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: [email protected] >
