1
0
Fork 0

Adding upstream version 4.2.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-14 05:52:19 +01:00
parent 16732c81e5
commit 4fd4995b67
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
279 changed files with 77998 additions and 0 deletions

48
systemd/SUSE-mdadm_env.sh Normal file
View file

@ -0,0 +1,48 @@
#!/bin/sh
# extract configuration from /etc/sysconfig/mdadm and write
# environment to /run/sysconfig/mdadm to be used by
# systemd unit files.
MDADM_SCAN="yes"
# Following adapted from /etc/init.d/mdadmd on openSUSE
mdadmd_CONFIG=/etc/sysconfig/mdadm
if test -r $mdadmd_CONFIG; then
. $mdadmd_CONFIG
fi
if [ x$MDADM_DELAY != x"" ]; then
MDADM_DELAY="-d "$MDADM_DELAY;
fi
if [ x$MDADM_MAIL != x"" ]; then
MDADM_MAIL="-m \"$MDADM_MAIL\""
fi
if [ x$MDADM_PROGRAM != x"" ]; then
MDADM_PROGRAM="-p \"$MDADM_PROGRAM\""
fi
if [ x$MDADM_SCAN = x"yes" ]; then
MDADM_SCAN="--scan"
else
MDADM_SCAN=""
fi
if [ x$MDADM_SEND_MAIL_ON_START = x"yes" ]; then
MDADM_SEND_MAIL="-t"
else
MDADM_SEND_MAIL=""
fi
if [ x$MDADM_CONFIG != x"" ]; then
MDADM_CONFIG="-c \"$MDADM_CONFIG\""
fi
mkdir -p /run/sysconfig
echo "MDADM_MONITOR_ARGS=$MDADM_RAIDDEVICES $MDADM_DELAY $MDADM_MAIL $MDADM_PROGRAM $MDADM_SCAN $MDADM_SEND_MAIL $MDADM_CONFIG" > /run/sysconfig/mdadm
if [ -n "$MDADM_CHECK_DURATION" ]; then
echo "MDADM_CHECK_DURATION=$MDADM_CHECK_DURATION" >> /run/sysconfig/mdadm
fi

View file

@ -0,0 +1,17 @@
# This file is part of mdadm.
#
# mdadm is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
[Unit]
Description=Manage MD Reshape on /dev/%I
DefaultDependencies=no
[Service]
ExecStart=BINDIR/mdadm --grow --continue /dev/%I
StandardInput=null
StandardOutput=null
StandardError=null
KillMode=none

View file

@ -0,0 +1,8 @@
[Unit]
Description=Activate md array %I even though degraded
DefaultDependencies=no
ConditionPathExists=!/sys/devices/virtual/block/%i/md/sync_action
[Service]
Type=oneshot
ExecStart=BINDIR/mdadm --run /dev/%i

View file

@ -0,0 +1,7 @@
[Unit]
Description=Timer to wait for more drives before activating degraded array %I.
DefaultDependencies=no
Conflicts=sys-devices-virtual-block-%i.device
[Timer]
OnActiveSec=30

4
systemd/mdadm.shutdown Normal file
View file

@ -0,0 +1,4 @@
#!/bin/sh
# We need to ensure all md arrays with external metadata
# (e.g. IMSM, DDF) are clean before completing the shutdown.
BINDIR/mdadm --wait-clean --scan

View file

@ -0,0 +1,17 @@
# This file is part of mdadm.
#
# mdadm is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
[Unit]
Description=MD array scrubbing - continuation
ConditionPathExistsGlob = /var/lib/mdcheck/MD_UUID_*
[Service]
Type=oneshot
Environment="MDADM_CHECK_DURATION=6 hours"
EnvironmentFile=-/run/sysconfig/mdadm
ExecStartPre=-/usr/lib/mdadm/mdadm_env.sh
ExecStart=/usr/share/mdadm/mdcheck --continue --duration ${MDADM_CHECK_DURATION}

View file

@ -0,0 +1,15 @@
# This file is part of mdadm.
#
# mdadm is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
[Unit]
Description=MD array scrubbing - continuation
[Timer]
OnCalendar= 1:05:00
[Install]
WantedBy= mdmonitor.service

View file

@ -0,0 +1,17 @@
# This file is part of mdadm.
#
# mdadm is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
[Unit]
Description=MD array scrubbing
Wants=mdcheck_continue.timer
[Service]
Type=oneshot
Environment="MDADM_CHECK_DURATION=6 hours"
EnvironmentFile=-/run/sysconfig/mdadm
ExecStartPre=-/usr/lib/mdadm/mdadm_env.sh
ExecStart=/usr/share/mdadm/mdcheck --duration ${MDADM_CHECK_DURATION}

View file

@ -0,0 +1,16 @@
# This file is part of mdadm.
#
# mdadm is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
[Unit]
Description=MD array scrubbing
[Timer]
OnCalendar=Sun *-*-1..7 1:00:00
[Install]
WantedBy= mdmonitor.service
Also= mdcheck_continue.timer

28
systemd/mdmon@.service Normal file
View file

@ -0,0 +1,28 @@
# This file is part of mdadm.
#
# mdadm is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
[Unit]
Description=MD Metadata Monitor on /dev/%I
DefaultDependencies=no
Before=initrd-switch-root.target
[Service]
# mdmon should never complain due to lack of a platform,
# that is mdadm's job if at all.
Environment=IMSM_NO_PLATFORM=1
# The mdmon starting in the initramfs (with dracut at least)
# cannot see sysfs after root is mounted, so we will have to
# 'takeover'. As the '--offroot --takeover' don't hurt when
# not necessary, are are useful with root-on-md in dracut,
# have them always present.
ExecStart=BINDIR/mdmon --offroot --takeover %I
Type=forking
# Don't set the PIDFile. It isn't necessary (systemd can work
# it out) and systemd will remove it when transitioning from
# initramfs to rootfs.
#PIDFile=/run/mdadm/%I.pid
KillMode=none

View file

@ -0,0 +1,15 @@
# This file is part of mdadm.
#
# mdadm is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
[Unit]
Description=Reminder for degraded MD arrays
[Service]
Environment=MDADM_MONITOR_ARGS=--scan
EnvironmentFile=-/run/sysconfig/mdadm
ExecStartPre=-/usr/lib/mdadm/mdadm_env.sh
ExecStart=BINDIR/mdadm --monitor --oneshot $MDADM_MONITOR_ARGS

View file

@ -0,0 +1,15 @@
# This file is part of mdadm.
#
# mdadm is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
[Unit]
Description=Reminder for degraded MD arrays
[Timer]
OnCalendar= 2:00:00
[Install]
WantedBy= mdmonitor.service

16
systemd/mdmonitor.service Normal file
View file

@ -0,0 +1,16 @@
# This file is part of mdadm.
#
# mdadm is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
[Unit]
Description=MD array monitor
DefaultDependencies=no
[Service]
Environment= MDADM_MONITOR_ARGS=--scan
EnvironmentFile=-/run/sysconfig/mdadm
ExecStartPre=-/usr/lib/mdadm/mdadm_env.sh
ExecStart=BINDIR/mdadm --monitor $MDADM_MONITOR_ARGS