Bug#658701: mdadm: should send email if mismatches are reported by a check

Russell Coker russell at coker.com.au
Sun Feb 5 12:34:50 UTC 2012


Package: mdadm
Version: 3.2.3-2
Severity: important

Feb  5 22:55:09 xev mdadm[20730]: RebuildFinished event detected on md device /dev/md0, component device  mismatches found: 20608 (on raid level 1)

When a check initiated by /etc/cron.d/mdadm finds an error mdadm will discover
this and log an error such as the above with facility DAEMON.  But it doesn't
send an email.

I believe that this is a serious bug, it seems to me that one of the most
significant conditions it can encounter that should be immediately reported to
the sysadmin is the fact that the contents of disks are changing and breaking
RAID consistency!

For a 3-disk mirror or a RAID-6 such an error can be reliably corrected as long
as all the other disks are fine.  If you have an array with double-redundancy
and one disk fails entirely while another returns dodgey data then you lose,
and obviously anyone who creates a doubly-redundant array wants protection
against that sort of thing.

With a RAID-1 or RAID-5 array every mismatch is an indication of real data
corruption and is very important.

The following patch makes mdadm send email about such events.

--- /tmp/Monitor.c	2012-02-05 23:28:41.873079816 +1100
+++ ./Monitor.c	2012-02-05 23:32:03.961132380 +1100
@@ -364,6 +364,7 @@
 	    (strncmp(event, "Fail", 4)==0 ||
 	     strncmp(event, "Test", 4)==0 ||
 	     strncmp(event, "Spares", 6)==0 ||
+	     (strncmp(event, "RebuildFinished", 15)==0 && disc) ||
 	     strncmp(event, "Degrade", 7)==0)) {
 		FILE *mp = popen(Sendmail, "w");
 		if (mp) {

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages mdadm depends on:
ii  debconf      1.5.41
ii  initscripts  2.88dsf-22
ii  libc6        2.13-25
ii  lsb-base     3.2-28.1
ii  udev         175-3

Versions of packages mdadm recommends:
ii  module-init-tools               3.16-1
ii  postfix [mail-transport-agent]  2.8.7-1

mdadm suggests no packages.

-- debconf information:
  mdadm/initrdstart_msg_errexist:
  mdadm/initrdstart_msg_intro:
* mdadm/autostart: false
  mdadm/autocheck: true
  mdadm/initrdstart_msg_errblock:
  mdadm/mail_to: root
  mdadm/initrdstart_msg_errmd:
* mdadm/initrdstart: none
  mdadm/initrdstart_msg_errconf:
  mdadm/initrdstart_notinconf: false
  mdadm/start_daemon: true





More information about the pkg-mdadm-devel mailing list