From: Alan J. Pippin Date: Mon, 1 Feb 2021 01:44:04 +0000 (-0700) Subject: Added new option to expect empty remote lists when backing up to a new disk X-Git-Url: http://git.pippins.net/embedvideo/.git/%7Bupdate_month%7D?a=commitdiff_plain;h=042746138ba0f15394db01ce99dd5b5e81002451;p=zfs-ubuntu%2F.git Added new option to expect empty remote lists when backing up to a new disk Change-Id: I77f3f0323f876adbb3e46640dc3acee9e3b43146 --- diff --git a/zfs-replicate b/zfs-replicate index 7f205e2..a5a3ad9 100755 --- a/zfs-replicate +++ b/zfs-replicate @@ -170,7 +170,7 @@ $zfs list -H -t snapshot | grep ^${backup_pool}/${remote_fs}@ | grep -v ^${backup_pool}/${current_backup_marker} | awk "{gsub(/^$backup_pool./,\"\",\$1); print\$1}" > $local_list -if [ $? != 0 ]; then +if [[ $? != 0 ]] && [[ $expect_empty_remote_list == 0 ]]; then fatal_and_exit "-E- local $zfs list on $hostname command failed" $mailto fi diff --git a/zfs-scripts.conf.dist b/zfs-scripts.conf.dist index 894f783..e4f3651 100644 --- a/zfs-scripts.conf.dist +++ b/zfs-scripts.conf.dist @@ -38,6 +38,11 @@ backup_pool= # import backup pool before replication and export backup pool after replication import_export_backup_pool=0 +# expect empty remote list +# - set to 1 if backing up any new filesystems for the first time +# - set to 0 if not backing up new filesystems for the first time (to prevent dropping the entire filesystem if the remote list command fails) +expect_empty_remote_list=0 + # when this variable is set, local filesystems will be destroyed # before receiving a full streams into them from the remote source. # if it needs to do this, and this option is set to 0, it aborts.