borgbackup / borg

Deduplicating archiver with compression and authenticated encryption.
https://www.borgbackup.org/
Other
10.73k stars 733 forks source link

Please add a way to keep backups independently of pruning retention policy #8205

Open LaurentBonnaud opened 1 month ago

LaurentBonnaud commented 1 month ago

Hi, I am using borg prune to reduce the disk space used by my backups. I would like to be able to mark some backups as "not prunable" so that they are excluded from the daily/weekly/monthly retention policy that I defined. My use case for this new feature is to keep a last backup of my system before a major OS upgrade. Those upgrades are done at a point in time that is unrelated to weeks and months. Thank you for considering this suggested addition!

LaurentBonnaud commented 1 month ago

This feature request is related to issue #846, but is more limited in scope and should be easier to implement.

ThomasWaldmann commented 1 month ago

You can already do that by using --prefix with prune. Then simply rename the archives you do NOT want to get deleted so that they do NOT match the prefix any more.

E.g.

borg prune --dry-run --list --prefix server-backup- ...

To keep, rename archives to keep-server-backup-* .

When experimenting with prune, always use --dry-run --list for test runs before running it without --dry-run to avoid unintended data loss.