diff --git a/modules.d/90mdraid/65-md-incremental-imsm.rules b/modules.d/90mdraid/65-md-incremental-imsm.rules index 80e6aab7..c4334dbd 100644 --- a/modules.d/90mdraid/65-md-incremental-imsm.rules +++ b/modules.d/90mdraid/65-md-incremental-imsm.rules @@ -35,6 +35,6 @@ RUN+="/sbin/initqueue --timeout --name 50-mdraid_start --onetime --unique /sbin/ # LABEL="md_incremental" -RUN+="/sbin/mdadm -I $env{DEVNAME}" +RUN+="/sbin/mdadm $env{rd_MD_OFFROOT} -I $env{DEVNAME}" LABEL="md_end" diff --git a/modules.d/90mdraid/md-shutdown.sh b/modules.d/90mdraid/md-shutdown.sh index bc361664..0d41008c 100755 --- a/modules.d/90mdraid/md-shutdown.sh +++ b/modules.d/90mdraid/md-shutdown.sh @@ -4,8 +4,9 @@ _do_md_shutdown() { local ret local final=$1 + local _offroot=$(strstr "$(mdadm --help-options 2>&1)" offroot && echo --offroot) info "Disassembling mdraid devices." - mdadm -v --stop --scan + mdadm $_offroot -v --stop --scan ret=$? if [ "x$final" != "x" ]; then info "cat /proc/mdstat" diff --git a/modules.d/90mdraid/mdraid-cleanup.sh b/modules.d/90mdraid/mdraid-cleanup.sh index 2e8a389d..9c4bc18c 100755 --- a/modules.d/90mdraid/mdraid-cleanup.sh +++ b/modules.d/90mdraid/mdraid-cleanup.sh @@ -4,6 +4,7 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh +_offroot=$(strstr "$(mdadm --help-options 2>&1)" offroot && echo --offroot) containers="" for md in /dev/md[0-9_]*; do [ -b "$md" ] || continue @@ -13,11 +14,11 @@ for md in /dev/md[0-9_]*; do containers="$containers $md" continue fi - mdadm -S "$md" >/dev/null 2>&1 || need_shutdown + mdadm $_offroot -S "$md" >/dev/null 2>&1 || need_shutdown done for md in $containers; do - mdadm -S "$md" >/dev/null 2>&1 || need_shutdown + mdadm $_offroot -S "$md" >/dev/null 2>&1 || need_shutdown done -unset containers udevinfo +unset containers udevinfo _offroot diff --git a/modules.d/90mdraid/mdraid-waitclean.sh b/modules.d/90mdraid/mdraid-waitclean.sh index 2f2a7535..68204dd6 100755 --- a/modules.d/90mdraid/mdraid-waitclean.sh +++ b/modules.d/90mdraid/mdraid-waitclean.sh @@ -3,6 +3,7 @@ # ex: ts=8 sw=4 sts=4 et filetype=sh if getargbool 0 rd.md.waitclean; then + _offroot=$(strstr "$(mdadm --help-options 2>&1)" offroot && echo --offroot) type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh containers="" for md in /dev/md[0-9_]*; do @@ -14,13 +15,13 @@ if getargbool 0 rd.md.waitclean; then continue fi info "Waiting for $md to become clean" - mdadm -W "$md" >/dev/null 2>&1 + mdadm $_offroot -W "$md" >/dev/null 2>&1 done for md in $containers; do info "Waiting for $md to become clean" - mdadm -W "$md" >/dev/null 2>&1 + mdadm $_offroot -W "$md" >/dev/null 2>&1 done - unset containers udevinfo + unset containers udevinfo _offroot fi diff --git a/modules.d/90mdraid/mdraid_start.sh b/modules.d/90mdraid/mdraid_start.sh index f4b7ad0c..545a8354 100755 --- a/modules.d/90mdraid/mdraid_start.sh +++ b/modules.d/90mdraid/mdraid_start.sh @@ -7,6 +7,8 @@ _md_force_run() { local _udevinfo local _path_s local _path_d + local _offroot + _offroot=$(strstr "$(mdadm --help-options 2>&1)" offroot && echo --offroot) # try to force-run anything not running yet for md in /dev/md[0-9_]*; do [ -b "$md" ] || continue @@ -20,7 +22,7 @@ _md_force_run() { # inactive ? [ "$(cat "$_path_s")" != "inactive" ] && continue - mdadm -R "$md" 2>&1 | vinfo + mdadm $_offroot -R "$md" 2>&1 | vinfo # still inactive ? [ "$(cat "$_path_s")" = "inactive" ] && continue @@ -29,7 +31,7 @@ _md_force_run() { [ ! -r "$_path_d" ] && continue # workaround for mdmon bug - [ "$(cat "$_path_d")" -gt "0" ] && mdmon --takeover "$md" + [ "$(cat "$_path_d")" -gt "0" ] && mdmon $_offroot --takeover "$md" done } diff --git a/modules.d/90mdraid/parse-md.sh b/modules.d/90mdraid/parse-md.sh index b85a3a3f..1482f2f1 100755 --- a/modules.d/90mdraid/parse-md.sh +++ b/modules.d/90mdraid/parse-md.sh @@ -51,3 +51,5 @@ if ! getargbool 1 rd.md.ddf -n rd_NO_MDDDF || getarg noddfmd || getarg nodmraid; info "no MD RAID for SNIA ddf raids" udevproperty rd_NO_MDDDF=1 fi + +strstr "$(mdadm --help-options 2>&1)" offroot && udevproperty rd_MD_OFFROOT=--offroot