No auto-check md-RAID in AL9

In RHEL8/AL8, it will check raid once a week, in a system which has set LVM-RAID while the installing of the system.

# in centos8
[root@centos8 ~]# cat /etc/cron.d/raid-check 
# Run system wide raid-check once a week on Sunday at 1am by default
0 1 * * Sun root /usr/sbin/raid-check

However, no auto-check in AL9.

On Alma 8 the dnf provides /etc/cron.d/raid-check says: “mdadm” and:

$ rpm -ql mdadm
/etc/cron.d/raid-check
/etc/libreport/events.d/mdadm_event.conf
/etc/sysconfig/raid-check
/usr/lib/.build-id
/usr/lib/.build-id/79
/usr/lib/.build-id/79/c2d9bece84ddd680ee6729e9ba5f15bcd8bb00
/usr/lib/.build-id/95
/usr/lib/.build-id/95/29cea4b00f0339679567866d171e3b12738e33
/usr/lib/mdadm/mdadm_env.sh
/usr/lib/systemd/system-shutdown/mdadm.shutdown
/usr/lib/systemd/system/mdadm-grow-continue@.service
/usr/lib/systemd/system/mdadm-last-resort@.service
/usr/lib/systemd/system/mdadm-last-resort@.timer
/usr/lib/systemd/system/mdcheck_continue.service
/usr/lib/systemd/system/mdcheck_continue.timer
/usr/lib/systemd/system/mdcheck_start.service
/usr/lib/systemd/system/mdcheck_start.timer
/usr/lib/systemd/system/mdmon@.service
/usr/lib/systemd/system/mdmonitor-oneshot.service
/usr/lib/systemd/system/mdmonitor-oneshot.timer
/usr/lib/systemd/system/mdmonitor.service
/usr/lib/tmpfiles.d/mdadm.conf
/usr/lib/udev/rules.d/01-md-raid-creating.rules
/usr/lib/udev/rules.d/63-md-raid-arrays.rules
/usr/lib/udev/rules.d/64-md-raid-assembly.rules
/usr/lib/udev/rules.d/65-md-incremental.rules
/usr/lib/udev/rules.d/69-md-clustered-confirm-device.rules
/usr/sbin/mdadm
/usr/sbin/mdmon
/usr/sbin/raid-check
/usr/share/doc/mdadm
/usr/share/doc/mdadm/COPYING
/usr/share/doc/mdadm/ChangeLog
/usr/share/doc/mdadm/TODO
/usr/share/doc/mdadm/mdadm.conf-example
/usr/share/doc/mdadm/mdcheck
/usr/share/doc/mdadm/syslog-events
/usr/share/man/man4/md.4.gz
/usr/share/man/man5/mdadm.conf.5.gz
/usr/share/man/man8/mdadm.8.gz
/usr/share/man/man8/mdmon.8.gz
/usr/share/mdadm/mdcheck
/var/run/mdadm

On Alma 9:

$ rpm -ql mdadm
/etc/libreport/events.d/mdadm_event.conf
/etc/sysconfig/raid-check
/run/mdadm
/usr/lib/.build-id
/usr/lib/.build-id/22
/usr/lib/.build-id/22/0a972cefcbded11211313b664b3c7f631c2d76
/usr/lib/.build-id/3c
/usr/lib/.build-id/3c/d4a032644d74bfe5191f4a3560d8cef0ea2eca
/usr/lib/systemd/system-shutdown/mdadm.shutdown
/usr/lib/systemd/system/mdadm-grow-continue@.service
/usr/lib/systemd/system/mdadm-last-resort@.service
/usr/lib/systemd/system/mdadm-last-resort@.timer
/usr/lib/systemd/system/mdcheck_continue.service
/usr/lib/systemd/system/mdcheck_continue.timer
/usr/lib/systemd/system/mdcheck_start.service
/usr/lib/systemd/system/mdcheck_start.timer
/usr/lib/systemd/system/mdmon@.service
/usr/lib/systemd/system/mdmonitor-oneshot.service
/usr/lib/systemd/system/mdmonitor-oneshot.timer
/usr/lib/systemd/system/mdmonitor.service
/usr/lib/systemd/system/raid-check.service
/usr/lib/systemd/system/raid-check.timer
/usr/lib/tmpfiles.d/mdadm.conf
/usr/lib/udev/rules.d/01-md-raid-creating.rules
/usr/lib/udev/rules.d/63-md-raid-arrays.rules
/usr/lib/udev/rules.d/64-md-raid-assembly.rules
/usr/lib/udev/rules.d/65-md-incremental.rules
/usr/lib/udev/rules.d/69-md-clustered-confirm-device.rules
/usr/sbin/mdadm
/usr/sbin/mdmon
/usr/sbin/raid-check
/usr/share/doc/mdadm
/usr/share/doc/mdadm/mdadm.conf-example
/usr/share/doc/mdadm/mdcheck
/usr/share/doc/mdadm/syslog-events
/usr/share/licenses/mdadm
/usr/share/licenses/mdadm/COPYING
/usr/share/man/man4/md.4.gz
/usr/share/man/man5/mdadm.conf.5.gz
/usr/share/man/man8/mdadm.8.gz
/usr/share/man/man8/mdmon.8.gz

Do notice:

AL8: /etc/cron.d/raid-check

AL9: /usr/lib/systemd/system/raid-check.service
     /usr/lib/systemd/system/raid-check.timer

Interestingly, on both:

$ cat /etc/sysconfig/raid-check
#!/bin/bash
#
# Configuration file for /etc/cron.weekly/raid-check
#
# options:
...

… while neither has that “/etc/cron.weekly/raid-check”.

On AL9:

$ systemctl status raid-check.service
○ raid-check.service - RAID setup health check
     Loaded: loaded (/usr/lib/systemd/system/raid-check.service; static)
     Active: inactive (dead)
$ systemctl status raid-check.timer
○ raid-check.timer - Weekly RAID setup health check
     Loaded: loaded (/usr/lib/systemd/system/raid-check.timer; disabled; vendor preset: disabled)
     Active: inactive (dead)
    Trigger: n/a
   Triggers: ● raid-check.service

I’d guess that one should enable the raid-check.timer.

1 Like

raid-check.timer maybe the right solution.

by the way, /etc/sysconfig/raid-check is used in /usr/sbin/raid-check:

[root@al9 ~]# grep sysconfig /usr/sbin/raid-check
# This script reads it's configuration from /etc/sysconfig/raid-check
[ -f /etc/sysconfig/raid-check ] || exit 0
. /etc/sysconfig/raid-check

so, this file is usefull.
However, the comments in file /etc/sysconfig/raid-check need to be modified, if using systemd_timer instead crond now.

the raid-check.service will run at 1 am Sunday, after,

systemctl enable --now raid-check.timer

However, it will only run for a minute without actually checking:

[root@al9 ~]# systemctl status raid-check.service
○ raid-check.service - RAID setup health check
     Loaded: loaded (/usr/lib/systemd/system/raid-check.service; static)
     Active: inactive (dead) since Sun 2022-06-26 01:01:13 CST; 11h ago
TriggeredBy: ● raid-check.timer
    Process: 1118722 ExecStart=/usr/sbin/raid-check (code=exited, status=0/SUCCESS)
   Main PID: 1118722 (code=exited, status=0/SUCCESS)
        CPU: 58ms

Jun 26 01:00:01 al9 systemd[1]: Starting RAID setup health check...
Jun 26 01:01:13 al9 systemd[1]: raid-check.service: Deactivated successfully.
Jun 26 01:01:13 al9 systemd[1]: Finished RAID setup health check.

Note that the actual check, which is turned on manually by command, will run for at least a dozen hours.

[root@al9 ~]# /usr/sbin/raid-check

Thus, the raid-check.service still not works fine.

Then, any way to check why raid-check.service only runs 1min ?

$ cat /usr/lib/systemd/system/raid-check.service
[Unit]
Description=RAID setup health check

[Service]
Type=oneshot
ExecStart=/usr/sbin/raid-check

I do not know why, the raid-check.service runs OK now in the second sunday after enable raid-check.timer.

Jul 03 01:00:01 al9 systemd[1]: Starting RAID setup health check...
Jul 04 04:57:24 al9 systemd[1]: raid-check.service: Deactivated successfully.
Jul 04 04:57:24 al9 systemd[1]: Finished RAID setup health check.
Jul 04 04:57:24 al9 systemd[1]: raid-check.service: Consumed 5.051s CPU time.

however it a good news.

I did not findout how two set it as ‘once per every two weeks’.
However, I am using the Semimonthly instead: (sunday of 1-7 or 15-21 of every month)

[root@al9 t~]# cat /etc/systemd/system/timers.target.wants/raid-check.timer
[Unit]
Description=Semimonthly RAID setup health check

[Timer]
OnCalendar=Sun *-*-1..7,15..21 01:00:00
Persistent=true
AccuracySec=24h

[Install]
WantedBy=timers.target
[root@al9 ~]# systemctl daemon-reload
[root@al9 ~]# systemctl restart raid-check.timer
[root@al9 ~]# systemctl list-timers