Re: How mdadm checks periodically the array in Debian 13 Trixie?
Hi,
On Thu, Sep 11, 2025 at 08:55:06PM +0200, Franco Martelli wrote:
> I want the check to start on the first Monday of each month at 5pm, I made
> these changes:
>
> ~$ cat /etc/systemd/system/mdcheck_start.timer.d/override.conf
> [Unit]
> Description=MD array scrubbing
>
> [Timer]
> OnCalendar=Mon *-*-1..7 17:00:00
> RandomizedDelaySec=24h
> Persistent=true
Note that "RandomizedDelaySec=24h" (from the original unit) causes the
timer to go off at a random time up to 24 hours from 17:00:00 on Monday,
so it could start at any time up to 17:00:00 Tuesday. If you don't like
that then you have to override that to:
RandomizedDelaySec=0
> Since the name of the file is "override.conf" I'm unsure that my changes are
> correct.
You normally don't need to put anything except what you are changing,
and it is best not to add things you don't need because some settings
are additive, i.e. you will keep the old setting and add yours too.
"OnCalendar" is one of these.
> - Should the …/override.conf file contain only the line:
>
> OnCalendar=Mon *-*-1..7 17:00:00
Since "OnCalendar" is additive, what this does is make it run at BOTH
times. You can verify this with:
# systemctl --list-timers mdcheck_start.timer
where you will see that its next trigger is still the Sunday.
To clear the OnCalendar you have to put:
OnCalendar=
OnCalendar=Mon *-*-1..7 17:00:00
This is true of many settings. You can find details in the
documentation which is quite thorough.
So in summary I think your override should be:
[Timer]
OnCalendar=
OnCalendar=Mon *-*-1..7 17:00:00
RandomizedDelaySec=0
Also bear in mind that the mcheck_start.service has:
ExecStart=/usr/share/mdadm/mdcheck --duration ${MDADM_CHECK_DURATION}
where MDADM_CHECK_DURATION is by default only 6 hours, meaning that
after 6 hours it will pause. The other timer and service pair,
mdcheck_continue, resumes these.
Thanks,
Andy
--
https://bitfolk.com/ -- No-nonsense VPS hosting
Please consider the environment before reading this e-mail.
— John Levine
Reply to: