zfs: try to import zpool in incremental mode

if the pool is not imported, zfs list will return a value. So to check
that the pool does not exist, we also import it.

fixes https://github.com/nix-community/disko/issues/690
This commit is contained in:
Jörg Thalheim authored and mergify[bot] committed 2024-06-28 13:52:20 +00:00
1 parent e8ef4773dd
commit 115311bc39
1 file changed
+3 -1
+3 -1
View File
@@ -62,7 +62,9 @@
inherit config options;
default = ''
readarray -t zfs_devices < <(cat "$disko_devices_dir"/zfs_${config.name})
if zpool list '${config.name}'; then
# Try importing the pool without mounting anything if it exists.
# This allows us to set mounpoints.
if zpool import -N -f '${config.name}' || zpool list '${config.name}'; then
echo "not creating zpool ${config.name} as a pool with that name already exists" >&2
else
continue=1