Bug#405919: checkarray does not report or fix mismatch_cnt issues
Tim Small
tim at seoss.co.uk
Tue Sep 28 14:48:10 UTC 2010
Package: mdadm
Version: 3.1.4-1+8efb9d1
Severity: normal
Tags: patch
Err, by the look of it, the patch which was referenced when this bug was
closed fixes the documentation only, not the fact that the mismatch count
isn't normally reported (actually, it does get reported by logcheck, but
it's still easy to miss in the logcheck output, not to mention most
people don't use logcheck).
The attached patch complains more vocally....
Tim.
*** /home/tim/mdadm-mismatch-fix.diff
--- mdadm.old 2010-09-28 15:35:15.954390947 +0100
+++ mdadm 2010-09-28 15:35:24.763517144 +0100
@@ -15,4 +15,49 @@
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 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 was 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:
+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