From bcf73c6e5c76dcb1adf1633545e30abf48c21df7 Mon Sep 17 00:00:00 2001
From: Edwin Eefting <edwin@datux.nl>
Date: Sun, 29 Mar 2020 23:47:26 +0200
Subject: [PATCH] --min-change is now has 1 instead of 200000 as default. fixes
 #37

---
 README.md          | 5 +++--
 bin/zfs-autobackup | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index 65dd7bb..a6d4605 100644
--- a/README.md
+++ b/README.md
@@ -408,7 +408,7 @@ optional arguments:
                         want a separate send-cronjob)
   --min-change MIN_CHANGE
                         Number of bytes written after which we consider a
-                        dataset changed (default 200000)
+                        dataset changed (default 1)
   --allow-empty         If nothing has changed, still create empty snapshots.
                         (same as --min-change=0)
   --ignore-replicated   Ignore datasets that seem to be replicated some other
@@ -533,6 +533,7 @@ Extra options needed for proxmox with HA:
 
 * --no-holds: To allow proxmox to destroy our snapshots if a VM migrates to another node.
 * --ignore-replicated: To ignore the replicated filesystems of proxmox on the receiving proxmox nodes. (e.g: only backup from the node where the VM is active)
+* --min-change 200000: Ignore replicated works by checking if there are no changes since the last snapshot. However for some reason proxmox always has some small changes. (Probably house-keeping data are something? This always was fine and suddenly changed with an update)
 
 I use the following backup script on the backup server:
 
@@ -540,7 +541,7 @@ I use the following backup script on the backup server:
 for H in h4 h5 h6; do
   echo "################################### DATA $H"
   #backup data filesystems to a common place
-  ./zfs-autobackup --ssh-source root@$H data_smartos03 zones/backup/zfsbackups/pxe1_data --clear-refreservation --clear-mountpoint  --ignore-transfer-errors --strip-path 2 --verbose --resume --ignore-replicated --no-holds $@
+  ./zfs-autobackup --ssh-source root@$H data_smartos03 zones/backup/zfsbackups/pxe1_data --clear-refreservation --clear-mountpoint  --ignore-transfer-errors --strip-path 2 --verbose --resume --ignore-replicated --min-change 200000 --no-holds $@
   zabbix-job-status backup_$H""_data_smartos03 daily $? >/dev/null 2>/dev/null
 
   echo "################################### RPOOL $H"
diff --git a/bin/zfs-autobackup b/bin/zfs-autobackup
index bdcd8e0..b5604a0 100755
--- a/bin/zfs-autobackup
+++ b/bin/zfs-autobackup
@@ -26,7 +26,7 @@ if sys.stdout.isatty():
     except ImportError:
         pass
 
-VERSION="3.0-rc8"
+VERSION="3.0-rc9"
 HEADER="zfs-autobackup v{} - Copyright 2020 E.H.Eefting (edwin@datux.nl)\n".format(VERSION)
 
 class Log:
@@ -1453,7 +1453,7 @@ class ZfsAutobackup:
         parser.add_argument('--other-snapshots', action='store_true', help='Send over other snapshots as well, not just the ones created by this tool.')
         parser.add_argument('--no-snapshot', action='store_true', help='Don\'t create new snapshots (usefull for finishing uncompleted backups, or cleanups)')
         parser.add_argument('--no-send', action='store_true', help='Don\'t send snapshots (usefull for cleanups, or if you want a serperate send-cronjob)')
-        parser.add_argument('--min-change', type=int, default=200000, help='Number of bytes written after which we consider a dataset changed (default %(default)s)')
+        parser.add_argument('--min-change', type=int, default=1, help='Number of bytes written after which we consider a dataset changed (default %(default)s)')
         parser.add_argument('--allow-empty', action='store_true', help='If nothing has changed, still create empty snapshots. (same as --min-change=0)')
         parser.add_argument('--ignore-replicated', action='store_true',  help='Ignore datasets that seem to be replicated some other way. (No changes since lastest snapshot. Usefull for proxmox HA replication)')
         parser.add_argument('--no-holds', action='store_true',  help='Don\'t lock snapshots on the source. (Usefull to allow proxmox HA replication to switches nodes)')