> Hi All,
>
> I have a raid 5 set up with kernel 2.1.124 and raidtools 0.90.
> It works fine. However, it is not clear how one knows whether
> a disk has failed. Is there a way to automate the disk failure
> notification (eg, to send mail to the sys admin)?
>
I use this little script:
*****************************
#! /bin/sh
#
# Version: 1.01 4-27-98-98 Michael A. Robinton <
# [EMAIL PROTECTED] >
#
# raidcheck This file must be executed periodically by cron
# It will check the raid status and e-mail a message if
# a status error is detected.
#
# USEAGE: raidcheck e-mail@addr {where to send error msg}
#
############ Save raid boot and status info ##############
MAILTO=$1
SENDMAILCMD="/usr/lib/sendmail -t -oi -O DeliveryMode=background"
RAIDHOST=`/bin/hostname`
if [ -f /etc/raidboot.conf ]
then
{
read RaidBootDevs
read RaidStatusPath
read RaidConfigEtc
} < /etc/raidboot.conf
# you must have issued
# cat /proc/mdstat | grep md0 >
# {your boot vol mnt(s)}/{RaidStatusPath}/raidgood.ref
# before linuxrc will execute properly with this info
#
# capture raid status
RAIDSTATUS=`/bin/cat /proc/mdstat | /usr/bin/grep md0`
/bin/mkdir /tmp/raid$$
# echo "Testing RAID read-only boot FLAG(s)."
RAIDREF="Raid reference file 'raidgood.ref' not found"
for Device in ${RaidBootDevs}
do
# get mount point for raid boot device or use tmp
RBmount=$( cat /proc/mounts | /usr/bin/grep ${Device} )
if [ -n ${RBmounts} ]; then
RBmount=$( echo ${RBmount} | cut -f 2 -d ' ' )
if [ -r ${RBmount}/${RaidStatusPath}/raidgood.ref ]; then
RAIDREF=`/bin/cat ${RBmount}/${RaidStatusPath}/raidgood.ref
2>&1` break
fi
else
RBmount="/tmp/raid$$"
/bin/mount ${Device} ${RBmount}
if [ -r ${RBmount}/${RaidStatusPath}/raidgood.ref ]; then
RAIDREF=`/bin/cat ${RBmount}/${RaidStatusPath}/raidgood.ref
2>&1` /bin/umount ${RBmount} break
else
/bin/umount ${RBmount}
fi
fi
done
/bin/rmdir /tmp/raid$$
# Test for a clean shutdown with array matching reference
if [ "${RAIDSTATUS}" != "${RAIDREF}" ]; then
${SENDMAILCMD} <<EOF123xxx
From:${RAIDHOST} <root@${RAIDHOST}>
To:${MAILTO}
Reply-To:root@${RAIDHOST}
Errors-To:root@${RAIDHOST}
Sender:root@${RAIDHOST}
Subject:ALERT Raid Device Failure on ${RAIDHOST}
${RAIDHOST} has detected an error in the raid status
The status should be:
${RAIDREF}
The status is:
${RAIDSTATUS}"
EOF123xxx
#| ${SENDMAILCMD}
fi
fi
********************************
raidboot.conf contains (tweak for your system)
********************************
/dev/hda1 /dev/hdc1
linux
raid5.conf
# comments may only be placed 'after' the three
# configuration lines.
#
# This is 'raidboot.conf'
#
# line one, the partition(s) containing the 'initrd' raid-rescue
# system
# It is not necessary to boot from these partitions, however,
# since the rescue system will not fit on floppy, it is
# necessary to know which partitions are to be used to load the
# rescue system
#
# line two, the path to the raidboot config information
# Where the shutdown status, etc... is located at boot time It
# does NOT include the mount point information, only 'path'
# /mntpoint/'path'
#
# line -3-, name of the raid configuration file
# Current raid configuration file i.e. raid1.conf, raid5.conf
[EMAIL PROTECTED]