Browse Source

borg-backup: skip .checkpoint archives

We may see an archive with ".checkpoint" on the end, as described in
[1]; the short version is this that borg stamps this every 30 minutes
and may appear if a long backup is interrupted.  Skip this when making
the list of archives to prune.

We noticed this on wiki-test; for clarity the list of archives looks
like

...
 wiki-upgrade-test-filesystem-2021-02-16T02:56:09.checkpoint Tue, 2021-02-16 02:56:11 [c444a0765e5791f3f68f08624d1efd80bf8a3ebc96bb225f08e4013befa2b460]
 wiki-upgrade-test-filesystem-2021-02-16T17:45:04 Tue, 2021-02-16 17:45:06 [b901b55ac3bf9abecba024caebad5ba7cd1a966e3f00b366f6cff45feba7bdff]
 wiki-upgrade-test-mysql-2021-02-16T18:35:09 Tue, 2021-02-16 18:35:11 [1d38cd3b4b1b3927b543e4ccc6c794cd3a513a70979ff025bbf303e1fe5e490f]
 wiki-upgrade-test-filesystem-2021-02-17T17:45:05 Wed, 2021-02-17 17:45:07 [f665e275c0014a21b82efaece5d36525a4ce6cb423253d5bd0b1323b230fa53a]
...

[1] https://borgbackup.readthedocs.io/en/stable/faq.html#if-a-backup-stops-mid-way-does-the-already-backed-up-data-stay-there

Change-Id: Ia33f46305ef8f541efb7c7150d4bb2e977b01d46
changes/22/816422/1
Ian Wienand 7 months ago
parent
commit
b9d98cca21
  1. 4
      playbooks/roles/borg-backup-server/files/prune-borg-backups.sh

4
playbooks/roles/borg-backup-server/files/prune-borg-backups.sh

@ -28,7 +28,9 @@ for u in borg-*; do
# Look at all archives and strip the timestamp, leaving just the archive names
# We limit the prune by --prefix so each archive is considered separately
archives=$(/opt/borg/bin/borg list ${BORG_REPO} | awk '{$1 = substr($1, 0, length($1)-20); print $1}' | sort | uniq)
# Long-running aborted backups might leave a ".checkpoint" archive around; ignore
# these as prune will remove them automatically
archives=$(/opt/borg/bin/borg list ${BORG_REPO} | awk '$1 !~ /\.checkpoint$/ { print substr($1, 0, length($1)-20) }' | sort | uniq)
for prefix in ${archives};
do

Loading…
Cancel
Save