Project

General

Profile

Actions

Submit #3287

closed

change HAMMER2 snapshot periodic script

Added by fgudin over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Low
Assignee:
-
Category:
Feature request
Target version:
Start date:
07/07/2021
Due date:
% Done:

100%

Estimated time:

Description

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


Files

220.diff (1.1 KB) 220.diff fgudin, 07/07/2021 05:46 AM
Actions

Also available in: Atom PDF