Restic Forget
restic forget removes snapshots according to a retention policy. With --prune, it also reclaims the freed space.
restic forget \
--prune \
--quiet \
--keep-daily 14 \
--keep-weekly 20
The flags:
--prune— delete the data of removed snapshots from the repository, not just the snapshot records.--quiet— less output.--keep-daily 14— keep one snapshot for each of the last 14 days on which a backup ran.--keep-weekly 20— keep one snapshot for each of the last 20 weeks.
The --keep-daily count is the part that confused me. It keeps one snapshot per day, for the last 14 days that had a backup. It does not mean that it simply keeps the 14 most recent snapshots.
- Run the backup 10 times in one day: you still keep one snapshot for that day.
- Run it once a day for 14 days: 14 snapshots, one per day.
- On day 15,
forgetdrops the oldest day, so you still have 14 — one for each of the last 14 days with a backup.