diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-02-24 14:34:34 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-02-24 14:34:34 +0000 |
commit | 946b54554e13d6a97940df936123855e0a305abc (patch) | |
tree | 80a778fbd7bb3c7858cfac572df1cb08cfa4f988 /systemd | |
parent | Initial commit. (diff) | |
download | mdadm-946b54554e13d6a97940df936123855e0a305abc.tar.xz mdadm-946b54554e13d6a97940df936123855e0a305abc.zip |
Adding upstream version 4.2.upstream/4.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'systemd')
-rw-r--r-- | systemd/SUSE-mdadm_env.sh | 48 | ||||
-rw-r--r-- | systemd/mdadm-grow-continue@.service | 17 | ||||
-rw-r--r-- | systemd/mdadm-last-resort@.service | 8 | ||||
-rw-r--r-- | systemd/mdadm-last-resort@.timer | 7 | ||||
-rw-r--r-- | systemd/mdadm.shutdown | 4 | ||||
-rw-r--r-- | systemd/mdcheck_continue.service | 17 | ||||
-rw-r--r-- | systemd/mdcheck_continue.timer | 15 | ||||
-rw-r--r-- | systemd/mdcheck_start.service | 17 | ||||
-rw-r--r-- | systemd/mdcheck_start.timer | 16 | ||||
-rw-r--r-- | systemd/mdmon@.service | 28 | ||||
-rw-r--r-- | systemd/mdmonitor-oneshot.service | 15 | ||||
-rw-r--r-- | systemd/mdmonitor-oneshot.timer | 15 | ||||
-rw-r--r-- | systemd/mdmonitor.service | 16 |
13 files changed, 223 insertions, 0 deletions
diff --git a/systemd/SUSE-mdadm_env.sh b/systemd/SUSE-mdadm_env.sh new file mode 100644 index 0000000..c13b48a --- /dev/null +++ b/systemd/SUSE-mdadm_env.sh @@ -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 diff --git a/systemd/mdadm-grow-continue@.service b/systemd/mdadm-grow-continue@.service new file mode 100644 index 0000000..5c667d2 --- /dev/null +++ b/systemd/mdadm-grow-continue@.service @@ -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 diff --git a/systemd/mdadm-last-resort@.service b/systemd/mdadm-last-resort@.service new file mode 100644 index 0000000..efeb3f6 --- /dev/null +++ b/systemd/mdadm-last-resort@.service @@ -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 diff --git a/systemd/mdadm-last-resort@.timer b/systemd/mdadm-last-resort@.timer new file mode 100644 index 0000000..45ad223 --- /dev/null +++ b/systemd/mdadm-last-resort@.timer @@ -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 diff --git a/systemd/mdadm.shutdown b/systemd/mdadm.shutdown new file mode 100644 index 0000000..33f2778 --- /dev/null +++ b/systemd/mdadm.shutdown @@ -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 diff --git a/systemd/mdcheck_continue.service b/systemd/mdcheck_continue.service new file mode 100644 index 0000000..854317f --- /dev/null +++ b/systemd/mdcheck_continue.service @@ -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} diff --git a/systemd/mdcheck_continue.timer b/systemd/mdcheck_continue.timer new file mode 100644 index 0000000..dba1074 --- /dev/null +++ b/systemd/mdcheck_continue.timer @@ -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 diff --git a/systemd/mdcheck_start.service b/systemd/mdcheck_start.service new file mode 100644 index 0000000..3bb3d13 --- /dev/null +++ b/systemd/mdcheck_start.service @@ -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} diff --git a/systemd/mdcheck_start.timer b/systemd/mdcheck_start.timer new file mode 100644 index 0000000..9e7e02a --- /dev/null +++ b/systemd/mdcheck_start.timer @@ -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 diff --git a/systemd/mdmon@.service b/systemd/mdmon@.service new file mode 100644 index 0000000..85a3a7c --- /dev/null +++ b/systemd/mdmon@.service @@ -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 diff --git a/systemd/mdmonitor-oneshot.service b/systemd/mdmonitor-oneshot.service new file mode 100644 index 0000000..373955a --- /dev/null +++ b/systemd/mdmonitor-oneshot.service @@ -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 diff --git a/systemd/mdmonitor-oneshot.timer b/systemd/mdmonitor-oneshot.timer new file mode 100644 index 0000000..cb54bda --- /dev/null +++ b/systemd/mdmonitor-oneshot.timer @@ -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 diff --git a/systemd/mdmonitor.service b/systemd/mdmonitor.service new file mode 100644 index 0000000..46f7b88 --- /dev/null +++ b/systemd/mdmonitor.service @@ -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 |