Jump to content

Recommended Posts

Posted

Hey, the last time my Helios4's PSU blew I suspect was due to a power overload, with the PSU not being able to deal with all 4 HDDs doing active work (this also killed one of the HDDs in my array). Based on the system log, it looked like the system was doing a regular integrity checks on all 4 HDDs at once (!).

 

I would like to either disable the integrity check altogether, or more ideally, spread it out. I have two RAID-1 arrays, and there is no reason for all four drives to be checked simultaneously. For example, I can check one of the arrays (two HDDs) and then once that is done, the second array (the other two HDDs) after.

 

Does anyone know where the code/script for the integrity check lives? The closest I found was /etc/cron.daily/mdadm which runs

mdadm --monitor --scan --oneshot

but from the manpage description it is unclear to me whether that is superficial check or that may actually invoke a deep and lengthy integrity check.

Posted

Hi Nathan,

This is something that indeed is done by mdadm configuration. You need to check /etc/cron.d/mdadm:

#
# cron.d/mdadm -- schedules periodic redundancy checks of MD devices
#
# Copyright © martin f. krafft <madduck@madduck.net>
# distributed under the terms of the Artistic Licence 2.0
#

# By default, run at 00:57 on every Sunday, but do nothing unless the day of
# the month is less than or equal to 7. Thus, only run on the first Sunday of
# each month. crontab(5) sucks, unfortunately, in this regard; therefore this
# hack (see #380425).
57 0 * * 0 root if [ -x /usr/share/mdadm/checkarray ] && [ $(date +\%d) -le 7 ]; then /usr/share/mdadm/checkarray --cron --all --idle --quiet; fi

You can either disable this cronjob by commenting out the actual cron entry, or by moving the file 'mdadm' out of the '/etc/cron.d' folder.

 

Easiest would be to write a script that will iterare all mdadm devices, start the redundancy check, wait for the check to complete. then move to the next mdadm device.

 

Something like:

#!/bin/bash

case "$( /usr/bin/id -u )" in
'0')
	;;
*)
	echo "Please run as root user."
	exit 1
	;;
esac

for MD in /dev/md[0-9]*
do
	SYNC_ACTION="/sys/block/${MD:?}/md/sync_action"
	( echo 'check' > "${SYNC_ACTION:?}" ) || exit 1

	while true
	do
		case "$( /usr/bin/cat "${SYNC_ACTION:?}" )" in
		'')
			exit
			;;
		'idle') 
			break
			;;
		esac
		sleep 10
	done
done

# EOF

 

Note that that code snippet was not tested, but should give you direction to your solution.

 

Hope that helps,

Groetjes,

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines