check if UUID is used

This commit is contained in:
Daniel Hansson 2020-05-02 22:36:15 +02:00 committed by GitHub
parent 403143d3aa
commit 0d6ab8a7f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

18
lib.sh
View File

@ -1245,17 +1245,19 @@ fi
if ! zpool list "$POOLNAME" >/dev/null 2>&1
then
zpool import -f "$POOLNAME"
else
return 1
fi
# Get UUID
if fdisk -l /dev/sdb1 >/dev/null 2>&1
# Check if UUID is used
if zpool list -v | grep sdb
then
UUID_SDB1=$(blkid -o value -s UUID /dev/sdb1)
# Get UUID
if fdisk -l /dev/sdb1 >/dev/null 2>&1
then
UUID_SDB1=$(blkid -o value -s UUID /dev/sdb1)
fi
# Export / import the correct way (based on UUID)
check_command zpool export "$POOLNAME"
check_command zpool import -d /dev/disk/by-uuid/"$UUID_SDB1" "$POOLNAME"
fi
# Export / import the correct way
check_command zpool export "$POOLNAME"
check_command zpool import -d /dev/disk/by-uuid/"$UUID_SDB1" "$POOLNAME"
}
## bash colors