c8f3db
#!/bin/bash
c8f3db
#
c8f3db
# Configuration file for /etc/cron.weekly/raid-check
c8f3db
#
c8f3db
# options:
c8f3db
#	ENABLED - must be yes in order for the raid check to proceed
c8f3db
#	CHECK - can be either check or repair depending on the type of
c8f3db
#		operation the user desires.  A check operation will scan
c8f3db
#		the drives looking for bad sectors and automatically
c8f3db
#		repairing only bad sectors.  If it finds good sectors that
c8f3db
#		contain bad data (meaning that the data in a sector does
c8f3db
#		not agree with what the data from another disk indicates
c8f3db
#		the data should be, for example the parity block + the other
c8f3db
#		data blocks would cause us to think that this data block
c8f3db
#		is incorrect), then it does nothing but increments the
c8f3db
#		counter in the file /sys/block/$dev/md/mismatch_count.
c8f3db
#		This allows the sysadmin to inspect the data in the sector
c8f3db
#		and the data that would be produced by rebuilding the
c8f3db
#		sector from redundant information and pick the correct
c8f3db
#		data to keep.  The repair option does the same thing, but
c8f3db
#		when it encounters a mismatch in the data, it automatically
c8f3db
#		updates the data to be consistent.  However, since we really
c8f3db
#		don't know whether it's the parity or the data block that's
c8f3db
#		correct (or which data block in the case of raid1), it's
c8f3db
#		luck of the draw whether or not the user gets the right
c8f3db
#		data instead of the bad data.  This option is the default
c8f3db
#		option for devices not listed in either CHECK_DEVS or
c8f3db
#		REPAIR_DEVS.
c8f3db
#	CHECK_DEVS - a space delimited list of devs that the user specifically
c8f3db
#		wants to run a check operation on.
c8f3db
#	REPAIR_DEVS - a space delimited list of devs that the user
c8f3db
#		specifically wants to run a repair on.
c8f3db
#	SKIP_DEVS - a space delimited list of devs that should be skipped
c8f3db
#	NICE - Change the raid check CPU and IO priority in order to make
c8f3db
#		the system more responsive during lengthy checks.  Valid
c8f3db
#		values are high, normal, low, idle.
c8f3db
#	MAXCONCURENT - Limit the number of devices to be checked at a time.
c8f3db
#		By default all devices will be checked at the same time.
c8f3db
#
c8f3db
# Note: the raid-check script intentionaly runs last in the cron.weekly
c8f3db
# sequence.  This is so we can wait for all the resync operations to complete
c8f3db
# and then check the mismatch_count on each array without unduly delaying
c8f3db
# other weekly cron jobs.  If any arrays have a non-0 mismatch_count after
c8f3db
# the check completes, we echo a warning to stdout which will then me emailed
c8f3db
# to the admin as long as mails from cron jobs have not been redirected to
c8f3db
# /dev/null.  We do not wait for repair operations to complete as the
c8f3db
# md stack will correct any mismatch_cnts automatically.
c8f3db
#
c8f3db
# Note2: you can not use symbolic names for the raid devices, such as you
c8f3db
# /dev/md/root.  The names used in this file must match the names seen in
c8f3db
# /proc/mdstat and in /sys/block.
c8f3db
c8f3db
ENABLED=yes
c8f3db
CHECK=check
c8f3db
NICE=low
c8f3db
# To check devs /dev/md0 and /dev/md3, use "md0 md3"
c8f3db
CHECK_DEVS=""
c8f3db
REPAIR_DEVS=""
c8f3db
SKIP_DEVS=""
c8f3db
MAXCONCURRENT=