mdadm/md-auto-readd.sh
Xiao Ni 72c1204567 Update to latest upstream and fix mdcheck service bug
Now mdcheck service can't be run successfully. We need to put mdcheck in to the
right place (/usr/share/mdadm/mdcheck) and it needs to remove the dependency of
mdadm_env.sh which is fixed in patch 76c224c6c.

And there is a history problem. It needed KillMode=none before, so it removed
the upstream patch 52c67fcdd. Now this problem has been fixed, so we can do the
backport more easilly now. We don't need to remove the upstream patch here again.

It adds a rhel only feature too for transient failure.

Resolves: rhbz#2159923, rhbz#2150865, rhbz#2124071, rhbz#2203859

Signed-off-by: Xiao Ni <xni@redhat.com>
2023-05-16 10:41:01 +08:00

18 lines
401 B
Bash

#!/usr/bin/bash
MDADM=/sbin/mdadm
DEVNAME=$1
export $(${MDADM} --examine --export ${DEVNAME})
if [ -z "${MD_UUID}" ]; then
exit 1
fi
UUID_LINK=$(readlink /dev/disk/by-id/md-uuid-${MD_UUID})
MD_DEVNAME=${UUID_LINK##*/}
export $(${MDADM} --detail --export /dev/${MD_DEVNAME})
if [ -z "${MD_METADATA}" ] ; then
exit 1
fi
${MDADM} --manage /dev/${MD_DEVNAME} --re-add ${DEVNAME} --verbose