Description
/kind enhancement
I have created a Borg repo that I use for manual backups only. Since I don't have a retention policy for this Borg repo either, I don't run borg prune
at the moment. However, I just noticed that borg prune
has another feature besides removing old archives according to a retention policy: removing old checkpoints.
Also, prune automatically removes checkpoint archives (incomplete archives left behind by interrupted backup runs) except if the checkpoint is the latest archive (and thus still needed). Checkpoint archives are not considered when comparing archive counts against the retention limits (
--keep-X
).
Since checkpoints aren't listed by borg list
by default, quite a lot of checkpoints can accumulate before one notices it.
Right now I can't easily remove just old checkpoints from a Borg repo; passing no --keep-*
option to borg prune
yields the error:
At least one of the "keep-within", "keep-last", "keep-secondly", "keep-minutely", "keep-hourly", "keep-daily", "keep-weekly", "keep-monthly" or "keep-yearly" settings must be specified.
One can work around this error by using a very large number for --keep-last
, e.g. --keep-last 1000000000
. Another solution is to mimic borg prune
's behaviour by using borg list --consider-checkpoints
, a little sed
magic and borg delete
.
IMO this is a reasonable use case and Borg should support it without taking such workarounds.
Thus I'd like to suggest adding a --keep-all
option to borg prune
, specifically telling borg prune
not to remove any actual archive, but just old checkpoints as explained before. Passing --keep-all
with any other --keep-*
option should probably thrown an error.