Billy Crook wrote: > Here's a couple trivial scripts I've used to pause execution until a > sync is completed. They are handy for when you want to do multiple > grow operations, each no sooner than after the previous completed. > Modify for your own purposes. > > [root@Eight bin]# cat raid-wait-till-sync-finish > #! /bin/bash > > export interval=300 > > if [[ $1 -gt 0 ]] > then > interval=$1 > fi > > echo -n Checking every ${interval} seconds for raid sync to finish. > > while [[ $( cat /sys/block/md*/md/sync_action | \ > grep -v idle | \ > wc -l ) -gt 0 ]] > do > echo -n . > sleep ${interval} > done > > echo Raid System Healthy! > > exit 0 > [root@Eight bin]# cat raid-wait-till-all-healthy > #! /bin/bash > > export clean=no > while [[ $clean==no ]] > do > #set clean to yes > clean=yes > > #Give each array the chance to set clean to no > for array in `ls -1 /sys/block/md*/md -d` > do > > if [[ $( cat $array/raid_disks ) -gt $( ls -1 $array/ | grep > ^rd[0-9]*$ | wc -l ) ]] > then > echo $array is still unclean > clean=no > fi > done > sleep 5 > done > Both of these can be replaced by mdadm --wait $device -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html