From 6bbdafce48bbd8a076e7f27bff17ea8fe6f531d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 25 Nov 2022 12:52:40 +0100 Subject: zapCreateMount: stop mdraids --- types.nix | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'types.nix') diff --git a/types.nix b/types.nix index 92f11fb..2ed3ccc 100644 --- a/types.nix +++ b/types.nix @@ -152,6 +152,7 @@ rec { */ zapCreateMount = devices: '' set -efux + shopt -s nullglob # print existing disks lsblk @@ -161,6 +162,12 @@ rec { umount -Rlv /mnt fi + # stop all existing raids + for r in /dev/md/* /dev/md[0-9]*; do + # might fail if the device was already closed in the loop + mdadm --stop "$r" || true + done + echo 'creating partitions...' ${diskoLib.create devices} echo 'mounting partitions...' -- cgit v1.2.3