fail early if destination fs doesn't exist

zfs receive will fail, but the source snapshot has already been created,
and the rotation/cleanup of old snapshots will be triggered
This commit is contained in:
Kevin McCormick 2016-09-12 11:28:48 -07:00
parent 48f905f0e2
commit 12f7666a2f

View File

@ -109,6 +109,11 @@ destfs="${dest#*:}"
# get the last src component # get the last src component
srcbase="${srcfs##*/}" srcbase="${srcfs##*/}"
# ensure the destination fs exists before proceeding
if [[ $(ZFS "$desthost" list -H -o name "$destfs" 2>/dev/null) != $destfs ]] ; then
die 1 "destination fs '$destfs' doesn't exist"
fi
### ###
### create new snapshot on src ### create new snapshot on src
### ###