How can I delete snapshots older than 30 days?

Hello! How can I delete snapshots older than 30 days?

Read docs before asking trivial questions.

https://restic.readthedocs.io/en/stable/060_forget.html

Then if something is not clear or you struggle to run it correctly, somebody can help.

1 Like

From what I understood in the docs, I should also run “restic prune” after forgetting old snapshots so their data don’t take space, am I right?

Yeap. forget only “forgets” snapshot not touching any real data. prune removes all garbage.

It’s worth pointing out the difference between --keep-daily and --keep-within-daily, too.

--keep-daily 30 will keep 30 snapshots, at least a day apart (per --group-by, which is host,paths by default). So you’ll have 30 snapshots of Host A with path 1, and 30 snapshots of Host A with Path 1 & Path 2, and 30 snapshots of Host B with Path 1. If that makes sense.

--keep-within-daily 30 will only keep snapshots within the last 30 days (per --group-by settings)

Definitely use --dry-run before pulling the trigger with either.

You can forget --dry-run first, then do forget --prune when you’re 100% sure. Or only forget, and do prune later. Doesn’t matter. But only prune removes the actual data.

You can do multiple forget runs with different settings, all quickly - and then do the actual prune command later to remove it all at once. What you don’t want to do is forget --prune, then forget --prune again with different settings. That’ll be slow and inefficient.

2 Likes

I’ve had great success using ChatGPT for building commands for me, while reading the docs.

1 Like