I just came across the new --keep-within feature which is a great addition. Unfortunately the documentation is not clear to me. Don’t know if my english is too poor or if I need more coffee.
--keep-within duration keep all snapshots which have been made within the duration of the latest snapshot.
What exactly does “duration of the latest snapshot” mean?
Additionally it is not clear to me which parameters take precedence over another when they are combined. If I make weekly snapshots and use --keep-last 10 --keep-within 1m, which option wins? I assume restic keeps 10 snapshots to be on the safe side, but I think this should be stated somewhere in the documentation.
The bad docs are my fault, sorry. Keep within will keep all snapshots within the duration given relative to the latest snapshots timestamp.
So if you give a duration of 12m, and your last snapshot was made 1m ago, it will keep all snapshots within 13 months of now. The reason it’s since the latest snapshot is to ensure you have a window of snapshots for that long which you can restore, rather than deleting snapshots over time just because time is passing.