Actions
Submit #3287
closedchange HAMMER2 snapshot periodic script
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
Updated by swildner over 3 years ago
- Status changed from New to Closed
Thanks, I've pushed it and cherry picked to 6.0.
Updated by tuxillo over 3 years ago
- Description updated (diff)
- Target version set to 6.2
- % Done changed from 0 to 100
Actions