diff --git a/prepare-zfs-datasets.sh b/prepare-zfs-datasets.sh index 04e95b8..ecd021e 100755 --- a/prepare-zfs-datasets.sh +++ b/prepare-zfs-datasets.sh @@ -9,6 +9,12 @@ echo "" echo "Enter the device to use for the ZFS pool (e.g., /dev/sdb):" read device +# Confirm the device is not in use +if mount | grep "$device"; then + echo "Error: $device is already mounted. Exiting..." + exit 1 +fi + # Ask for confirmation, since this script will destroy all data on the device echo "This script will destroy all data on $device. Are you sure you want to continue? (y/n)" read confirm