From f2b40a2ce80e80e8c9d9d6ef1b7a7a6fdbbad8ac Mon Sep 17 00:00:00 2001 From: Kevin McCormick Date: Thu, 4 Aug 2016 16:26:07 -0700 Subject: [PATCH] save only last component of src fs in dest Change zfs receive command to use -e (was -d). Allow greater control of dest placement. srcpool/a/really/long/path should not force me to deal with destpool/backupdest/a/really/long/path. --- backup-zfs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backup-zfs b/backup-zfs index 32c988c..e7cf38c 100755 --- a/backup-zfs +++ b/backup-zfs @@ -120,14 +120,14 @@ last="$(ZFS "$desthost" list -d 1 -t snapshot -H -S creation -o name $destfs/$sr # 1st time: send full snapshot if [[ -z $last ]] ; then log "sending full recursive snapshot from $src to $dest" - ZFS "$srchost" send -R "$cur" | ZFS "$desthost" receive -Fud "$destfs" + ZFS "$srchost" send -R "$cur" | ZFS "$desthost" receive -Fue "$destfs" # special case: tagged snapshots exist on dest, but src has rotated through all elif ! ZFS "$srchost" list $srcfs@$last &>/dev/null ; then die 1 "no incremental path from from $src to $dest" # normal case: send incremental else log "sending incremental snapshot from $src to $dest (${last#${tag}_}..${cur#*@${tag}_})" - ZFS "$srchost" send -R -I "$last" "$cur" | ZFS "$desthost" receive -Fud "$destfs" + ZFS "$srchost" send -R -I "$last" "$cur" | ZFS "$desthost" receive -Fue "$destfs" fi ###