From acd2cbdb312cab5492f28cdd1d7710bbc099f51b Mon Sep 17 00:00:00 2001 From: phaer Date: Tue, 9 Jan 2024 14:09:08 +0100 Subject: [PATCH] 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. --- disk-deactivate/disk-deactivate.jq | 3 +++ 1 file changed, 3 insertions(+) diff --git a/disk-deactivate/disk-deactivate.jq b/disk-deactivate/disk-deactivate.jq index 2523ff1..a55d559 100644 --- a/disk-deactivate/disk-deactivate.jq +++ b/disk-deactivate/disk-deactivate.jq @@ -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"