deactivate: stop raid if disk is a member of it

this is useful in cases where the target machine has
a pre-configured RAID setup, as otherwise disko would
wipe the partition tables and create new ones but would
not be able to inform the kernel about it, as the old
raid was still in use.
This commit is contained in:
phaer 2024-01-09 14:09:08 +01:00 committed by mergify[bot]
parent 11f4ed1041
commit acd2cbdb31

View File

@ -26,6 +26,9 @@ def remove:
def deactivate:
if .type == "disk" then
[
# If this disk is a member of raid, stop that raid
"mdadm --stop $(lsblk \(.path) -l -p -o type,name | awk 'match($1,\"raid.*\") {print $2}')",
# Remove all file-systems and other magic strings
"wipefs --all -f \(.path)",
# Remove the MBR bootstrap code
"dd if=/dev/zero of=\(.path) bs=440 count=1"