Bug#405919: checkarray does not report or fix mismatch_cnt issues

Tim Small tim at seoss.co.uk
Tue Sep 28 15:01:29 UTC 2010


Package: mdadm
Version: 3.1.4-1+8efb9d1
Severity: normal
Tags: patch

Perhaps this is a better patch in light of some of the points above.

Tim.

*** /home/tim/mdadm-mismatch-fix.diff
--- /etc/cron.daily/mdadm.old	2010-09-28 15:35:15.954390947 +0100
+++ /etc/cron.daily/mdadm	2010-09-28 15:59:14.422378309 +0100
@@ -15,4 +15,53 @@
 MDADM=/sbin/mdadm
 [ -x $MDADM ] || exit 0 # package may be removed but not purged
 
+PRINT_SUMMARY=0
+
+for mcnt in /sys/block/md?/md/mismatch_cnt
+do
+	if [ -f $mcnt ]
+	then
+		read cnt < $mcnt
+		if [ $cnt != 0 ]
+		then
+			cat << WARN_TEXT
+
+Warning - $mcnt indicates that the associated RAID
+device has $cnt blocks in which the data on one array member is inconsistent
+with the data on the other array member(s).
+WARN_TEXT
+			PRINT_SUMMARY=1
+		fi
+	fi
+done
+
+if [ $PRINT_SUMMARY != 0 ]
+then
+	cat << WARN_TEXT
+
+DATA LOSS MAY HAVE OCCURRED.
+
+This condition may have been caused by one of more of the following events:
+
+. A LEGITIMATE write to a memory mapped file or swap partition backed by a
+    RAID1 (and only a RAID1) device - see the md(4) man page for details.
+. A power failure when the array was being written-to.
+. Data corruption by a hard disk drive, drive controller, cable etc.
+. A kernel bug in the md or storage subsystems etc.
+. An array being forcibly created in an inconsistent state using --assume-clean
+
+This count is updated when the md subsystem carries out a 'check' or
+'repair' action.  In the case of 'repair' it reflects the number of
+mismatched blocks prior to carrying out the repair.
+
+Once you have fixed the error, carry out a 'check' action to reset the count
+to zero.
+
+See the md (section 4) manual page, and the following URL for details:
+
+https://raid.wiki.kernel.org/index.php/Linux_Raid#Frequently_Asked_Questions_-_FAQ
+
+WARN_TEXT
+fi
+
 exec $MDADM --monitor --scan --oneshot





More information about the pkg-mdadm-devel mailing list