Thank you for creating this snapshot solution. I already know the restic forget policy if we set --keep-daily 7, it will keep 1 per day in 7 days straight from newest backup.
I want to know if we set all the --keep-* parameter equal to 1. Will it only take the newest backup? Say --keep-last 1 --keep-daily 1 … --keep-yearly 1
I know this might be simple if to test it yourself, but I will need to have backups for a long time to make sure this is correct.
No, it is not only one snapshot unless all those rules happen to select the same snapshot. The keep rules are combined as a union: keep-last 1 keeps the newest, keep-daily 1 keeps one from the most recent day, keep-weekly 1 keeps one from the most recent week, and so on. For testing you can run forget with --dry-run and -v on a small test repo with fake old snapshots, or just inspect what would be removed before adding --prune.
Thank you for the answer, can you give example of when it can / can’t be more than one if we set 1 for each --keep-* ?
For values more than 1, the usual thing about retention is we might have less since it’s a union. I’m just wondering for the equal to 1. Since the last backup is the latest for each type of policy.
About fake backup, do you know the way to create it like 1 year?
As noeck says, you’ll keep the single most recent snapshot. That satisfies all of the keep-* criteria; the most recent snapshot is the most recent hourly, daily, weekly, monthly, and yearly snapshot.
❯ restic -r ~/tmp/restic-repo-able snapshots d3fb9dc8
repository c32c4c7d opened (version 2, compression level auto)
ID Time Host Tags Paths Size
--------------------------------------------------------------------------
d3fb9dc8 2026-06-24 20:52:18 hostname.local /etc/hosts 384 B
--------------------------------------------------------------------------
1 snapshots
❯ restic -r ~/tmp/restic-repo-able rewrite --new-time="2000-01-01 00:00:00" d3fb9dc8
enter password for repository:
repository c32c4c7d opened (version 2, compression level auto)
[0:00] 100.00% 4 / 4 index files loaded
snapshot d3fb9dc8 of [/etc/hosts] at 2026-06-24 20:52:18.859032283 +0100 BST by user@hostname.local
setting time to 2000-01-01 00:00:00 +0000 GMT
saved new snapshot a7257116
modified 1 snapshots
❯ restic -r ~/tmp/restic-repo-able snapshots a7257116
repository c32c4c7d opened (version 2, compression level auto)
ID Time Host Tags Paths Size
--------------------------------------------------------------------------
a7257116 2000-01-01 00:00:00 hostname.local rewrite /etc/hosts 384 B
--------------------------------------------------------------------------
1 snapshots
Now you can set the times to whatever you want, and test retention policies against snapshots taken on arbitrary dates.