From 3f5d270fef1a7286fa3f60195339d663a7f247c2 Mon Sep 17 00:00:00 2001 From: Daniel Hansson Date: Fri, 1 May 2020 17:14:42 +0200 Subject: [PATCH] only import if missing --- static/change-to-zfs-mount-generator.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/static/change-to-zfs-mount-generator.sh b/static/change-to-zfs-mount-generator.sh index e8b8740c..e06cccb7 100644 --- a/static/change-to-zfs-mount-generator.sh +++ b/static/change-to-zfs-mount-generator.sh @@ -36,7 +36,10 @@ fi # In either case it's always better to use UUID instead of the /dev/sdX name, so do that as well # Import zpool in case missing -zpool import -f "$POOLNAME" +if zpool list | grep -q 'no pools available' +then + zpool import -f "$POOLNAME" +fi # Get UUID if fdisk -l /dev/sdb1