borgbackup / borgbackup/borg

Customizable pruning

Open
#6,266 1 comment 0 reactions 0 assignees View on GitHub
cmd: prune enhancement
Dominant language
Python
Stars
13.7k
Forks
875
Avg merge
11h 15m
Merged PRs (30d)
192

Description

There are several open issues wrt. adding flexiblity/additional options to pruning:

- https://github.com/borgbackup/borg/issues/5720
- https://github.com/borgbackup/borg/issues/4750
- https://github.com/borgbackup/borg/issues/846

As an inbetween suggestion, that might be easier to implement and use than tags, I offer the following:

Add a flag `--keep-stdio` (open to bikeshedding) to `borg prune`.
When given the flag, borg would behave like `borg list --json && jq -r '.[]' | xargs -I '{}' -- borg delete ::{}` *but with proper locking*.
I.e.: borg would list all archives including some metadata (like timestamps) to stdout and expect a json list of archive names (or better: ids) on stdin. It would then keep all archives thus returned.
Any additional behaviour loaded unto prune (e.g. deleting superseded `\.checkpoint(\.[0-9]+)?$`-archives) would be unaffected.

The intended usage would be to wrap a call to `borg prune --prune-stdio` in a python script that implements whatever insane backup rotation strategy I want that week.

Would a pull request implementing this feature be welcome/have any chance of being merged eventually? (If I find the time to prepare one, of course)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.