[DragonFlyBSD - Submit #3287] (New) change HAMMER2 snapshot periodic script

bugtracker-admin at leaf.dragonflybsd.org bugtracker-admin at leaf.dragonflybsd.org
Wed Jul 7 05:15:00 PDT 2021


Issue #3287 has been reported by fgudin.

----------------------------------------
Submit #3287: change HAMMER2 snapshot periodic script
http://bugs.dragonflybsd.org/issues/3287

* Author: fgudin
* Status: New
* Priority: Low
* Assignee: 
* Category: Feature request
* Target version: 
----------------------------------------
Hi,
I'd like to propose a small modification to the way 220.snapshot-hammer2 handles scarce free space condition:

diff --git a/etc/periodic/daily/220.snapshot-hammer2 b/etc/periodic/daily/220.snapshot-hammer2
index 09962dc3f3..36ea83ce8e 100644
--- a/etc/periodic/daily/220.snapshot-hammer2
+++ b/etc/periodic/daily/220.snapshot-hammer2
@@ -54,12 +54,12 @@ case "${snap_enable}" in
                fi
                _df=$(df ${dir} | grep -oE "[0-9]+%")
                _pcnt=${_df%%%}
-               if [ ${_pcnt} -gt ${snap_capacity} ]; then
-                       echo "omitted, not enough free space"
-                       continue
+               if [ ${_pcnt} -le ${snap_capacity} ]; then
+                       hammer2 snapshot ${dir} ${dir}.${snap_tag}.$(date +%Y%m%d.%H:%M) \
+                               || rc=1
+               else
+                       echo "snapshot creation omitted, not enough free space"
                fi
-               hammer2 snapshot ${dir} ${dir}.${snap_tag}.$(date +%Y%m%d.%H:%M) \
-                       || rc=1
                _keep=${snap_keep}
                if [ "${_keep}" = "auto" ]; then
                        # adjust number of snapshots dynamically, according to free space

The idea is that whenever the user falls into free space shortage situation, the "sliding window" of snapshots potentially continues rolling forward, instead of becoming stuck into the past.

BR,
-- 
Francis




-- 
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account



More information about the Submit mailing list