From a89e47c3700ed1aad3d3f20c0cec603ed15ecd54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Mon, 25 Jun 2018 17:07:19 +0200 Subject: [PATCH] Exist if partitionned disks are found --- zpool.creation.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/zpool.creation.sh b/zpool.creation.sh index a660938..776d94c 100755 --- a/zpool.creation.sh +++ b/zpool.creation.sh @@ -12,12 +12,22 @@ DISK_TEMP_LIST="/tmp/zfs.disks" # Store disks list in a temp file find /dev/disk/by-vdev -maxdepth 1 -type l -printf "%f\\n" > "${DISK_TEMP_LIST}" -# Test zfs module {{{ +# Tests {{{ + +## zfs module {{{ if ! lsmod | grep -q "^zfs" then printf "%b\\n" "Try to load ZFS module" modprobe zfs fi +## }}} +## If a previous ZFS partitioning already exists {{{ +if find /dev/disk/by-vdev -maxdepth 1 -type l -iname "*part[0-9]*" > /dev/null 2>&1 +then + printf "%b\\n" "Some disks are already partitioned, please verify that you don't have a working ZFS configuration !" + exit 1 +fi +## }}} # }}} # Pool creation {{{ ## Initialize loop vars