Subject: Re: misc/14094: RAID array status isn't reported in daily jobs
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
From: Dave Sainty <dave@dtsp.co.nz>
List: netbsd-bugs
Date: 10/02/2001 18:28:25
Manuel Bouyer writes:

> You can't rely on the /dev/raid*.conf to get the list of raid
> devices, because there may autoconf raid in the system without the
> equivalent raid??.conf file.
>
> I'm using this to get the list of raid device:
> iostat -x | awk '/^raid/ { print $1 }'
> (sorry I don't remember who posted this in the first place).
> In /etc/daily I added this, which seems to do the job:
>         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
>                 fi
>                 rm -f $TMP
>         done
>         if [ -s $TMP2 ]; then
>                 echo "failed RAID component(s):"
>                 cat $TMP2
>         fi
>         rm -f $TMP2

Yes, I came up with this later after LukeM made a similar comment (but
omitted to send it here).  Cheaper than the above, but it doesn't look
specifically for failed devices...  You do get to see the (less
critical) parity status etc though.

But I'll be happy with whatever becomes part of NetBSD as standard. ;)

--- src/etc/daily.orig	Sat Sep 29 15:08:53 2001
+++ src/etc/daily	Sun Sep 30 12:18:31 2001
@@ -193,6 +193,19 @@
 	fi
 fi
 
+if checkyesno check_raid; then
+	iostat -x | while read device status; do
+		case "$device" in
+			raid[0-9]*)
+				echo ""
+				echo "RAID: Array status for ${device}:"
+				# Strip out the component label dump...
+				raidctl -s "$device" | awk -- '/^[A-Za-z]/ {show=1} /^Component label for/ {show=0} {if (show) print "  " $0;}'
+			;;
+		esac
+	done
+fi
+
 if checkyesno run_fsck; then
 	echo ""
 	echo "Checking filesystems:"