From 4a9558f5d4ae090ec568077846a08db7bd33090a Mon Sep 17 00:00:00 2001 From: Isaac Bennetch Date: Tue, 28 Oct 2025 11:50:49 -0400 Subject: [PATCH] Automatically run borg compact to reduce the size of pruned repositories Signed-off-by: Isaac Bennetch --- backup/backup | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/backup/backup b/backup/backup index 811e888..831350a 100755 --- a/backup/backup +++ b/backup/backup @@ -9,3 +9,10 @@ borg create ssh://borgbackup/./backups/`hostname`::'{now:%Y-%m-%d_%H:%M}' `cat / # - weekly backups for 8 weeks # - monthly backups for 12 months borg prune --keep-weekly 8 --keep-monthly 12 --keep-daily 14 ssh://borgbackup/./backups/`hostname` + +# Compact repository to free up disk space that is still in use after being de-allocated by prune. +# This is needed since Borg 1.2.0 +# Since it doesn't exist prior to 1.2.0, we test so as to avoid failing +if borg help compact >/dev/null 2>&1; then + borg compact ssh://borgbackup/./backups/`hostname` +fi