Bug#497949: mdadm: a cron.daily script to check would be helpful

Paul Slootman paul at debian.org
Fri Sep 5 15:58:07 UTC 2008


Package: mdadm
Version: 2.6.4-1
Severity: wishlist

In the old days, raidtools2 used to have a cron.daily script:

#!/bin/sh
# Cron job to check that raid devices are functional.
# On error cron will mail the fauly mdstat to root.
#   md.c appends (F) to a faulty device
#   raid1.c and raid5.c list devices as U (operational) or _ (not)
#   a _ device may be either hot, standby or bad
# Merlin Hughes <merlin at merlin.org> 

[ -e /proc/mdstat ] || exit 0 

mdstat=`cat /proc/mdstat`

if echo "$mdstat" | grep -q '\(F\)'; then
  echo 'WARNING: Some disks in your RAID arrays seem to have failed!'
  echo 'Below is the content of /proc/mdstat:'
  echo 
  echo "$mdstat"
fi



This is now a bit obsolete, and mdadm could step up here.
The mdadm manpage says:


  -1, --oneshot
     Check  arrays only once.  This will generate NewArray events and more
     significantly DegradedArray and SparesMissing events.  Running
             mdadm --monitor --scan -1
     from a cron script will ensure regular notification of  any  degraded
     arrays.


I'd like to see this added to the mdadm package.

Where I work we administer a server farm of about 250 systems. These
all generate quite some mail, and if we miss a message about a raid
failure, we'll never be reminded about this again (until a second disk
fails there....)
We were used to the raidtools2 cron job to remind us, but most of the
systems are now upgraded and raidtools isn't installed anymore.
Hence a cronjob installed by the mdadm package would be most welcome :-)


Thanks,
Paul Slootman





More information about the pkg-mdadm-devel mailing list