Every now and then something goes wrong with my Linux RAID, and some
weeks or months later I notice that the RAID is running in degraded
mode, and I take the appropriate steps.
Anyway, I've now added the following to the end of my /etc/rc.d/rc.local
file so that I notice upon a reboot, and thought I'd share it in case it
was of use to anyone else.
This works under RH7.2 and 2.4 kernels, but probably works on later and
versions and other distros. Here it is, FWIW:
------- cut here ----------
if dmesg | \
egrep "(raidtab|md[0-9]*:) .*(kicking|inconsistency|degraded|removing)" \
> /tmp/raidchk
then
{
cat /tmp/raidchk
cat <<-EOF
You may need to do something like:
raidhotadd /dev/mdN /dev/hdAM
watch cat /proc/mdstat
Raid arrays are described in /etc/raidtab.
luke
EOF
} | Mail -s "RAID problem" postmaster
fi
rm /tmp/raidchk
----------------------------------
Obviously you may want to change the mail recipient from postmaster to
the main administrator's account, and the example N and AM in the
raidhotadd example. (Also note the EOF must be preceded with a TAB
character for the above script to work, if you're cutting and pasting.)
luke
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html