I've got a software RAID setup using mdadm on a fully updated Ubuntu 20.04. I experience monthly ~31h array resyncs. I suspect this comes from /etc/default/mdadm
, which includes:
# AUTOCHECK:
# should mdadm run periodic redundancy checks over your arrays? See
# /etc/cron.d/mdadm.
AUTOCHECK=true
I'd like to change when this is scheduled, but I don't seem to have /etc/cron.d/mdadm
:
# apt policy mdadm
mdadm:
Installed: 4.1-5ubuntu1.2
Candidate: 4.1-5ubuntu1.2
Version table:
*** 4.1-5ubuntu1.2 500
500 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
100 /var/lib/dpkg/status
4.1-5ubuntu1 500
500 http://us.archive.ubuntu.com/ubuntu focal/main amd64 Packages
# find /etc -name '*mdadm*' -or -name '*checkarray*'
/etc/default/mdadm
/etc/monit/conf-available/mdadm
/etc/logcheck/violations.d/mdadm
/etc/logcheck/ignore.d.server/mdadm
/etc/modprobe.d/mdadm.conf
/etc/mdadm
/etc/mdadm/mdadm.conf
# dpkg -S /etc/cron.d/mdadm
dpkg-query: no path found matching pattern /etc/cron.d/mdadm
# grep -REi 'mdadm|raid|/dev/md|autocheck|checkarray' /etc/*cron*
#
So I'm guessing the Debian/Ubuntu documentation is outdated and that this check trigger has moved (to /usr/share/mdadm/checkarray
perhaps, though I still don't know what triggers it). The first dialog in dpkg-reconfigure mdadm
notes that this check triggers on the first Sunday of the month at 01:06 (see screenshot below), but I can't find the source of that trigger.
The best I can find is checkarray. My search:
# dpkg -L mdadm |xargs -d '\n' grep -Fswn AUTOCHECK
/usr/share/mdadm/checkarray: -c|--cron honour AUTOCHECK setting in /etc/default/mdadm.
/usr/share/mdadm/checkarray:if [ $cron = 1 ] && ! is_true ${AUTOCHECK:-false}; then
I'm guessing the solution is to set AUTOCHECK=false
, find the checkarray
command it would have run, then manually add my own cron job that replicates it. To do that, I'm looking to confirm this is the best option and to find the ideal arguments to pass it.
I'm also curious about what happened to the old method and where I might find updated documentation.
Bonus question: since resyncing takes so long, is there a way to break it up so I can do it incrementally over multiple nights?