Subject: raidframe scripts [ Re: Why my life is sucking. Part 2.]
To: Luke Mewburn <>
From: Manuel Bouyer <>
List: current-users
Date: 01/18/2001 14:50:41
On Thu, Jan 18, 2001 at 11:18:25PM +1100, Luke Mewburn wrote:
> I think that this is a good idea; I'll take a look at it as part of
> another idea I have...
> ...which is to change the parity rebuild system to only attempt to
> rebuild configured raid partitions. I don't have /etc/raidX.conf
> files; I rely upon raid auto-config to DTRT. This means that parity
> rebuilds won't happen unless I hack my scripts.
> Currently /etc/rc.d/raidframe does:
> 	for cfg in /etc/raid[0-9].conf /etc/raid[0-9][0-9].conf ; do
> 		[ ! -f $cfg ] && continue
> 		dev=${cfg##*/}
> 		dev=${dev%%.conf}
> 		raidctl -P $dev
> 	done
> and I think this could be changed to something functionally equivalent
> to:
> 	for $dev in `iostat -x | awk '/^raid/ { print $1 }'`; do
> 		raidctl -P $dev
> 	done
> We can't do this in the current script because iostat and awk are in
> /usr/{,sbin}, but Simon Burge has some (uncommitted) work which should
> allow me to get the same lists of `active' disks that `iostat -x`
> provides via /sbin/sysctl. On the other hand, we could just split the
> functionality now, and make the parity-rebuild component depend upon
> "mountcritremote" (which gets /usr).

I think this isn't a problem; especially as raidctl -P needs to be run after
quotacheck, for the same reason as fsck :)

While we're at it, I'd like to add something to report failed components
in /etc/daily, maybe in the check_disk section, or in a new check_raid section.
What I was missing is 'iostat -x' to get the list of configured devices :)

What about something like this ?

if checkyesno check_disks; then
        touch $TMP2
        for dev in `iostat -x | awk '/^raid/ { print $1 }'`; do
                raidctl -s $dev | awk '/^.*: failed$/ {print $0}' > $TMP
                if [ -s $TMP ]; then
                        echo "$dev:" >> $TMP2
                        cat $TMP >> $TMP2
                rm -f $TMP
        if [ -s $TMP2 ]; then
                echo "failed RAID component(s):"
                cat $TMP2
        rm -f $TMP2

Manuel Bouyer, LIP6, Universite Paris VI.