Max number of snapshots

I’m currently backing up my OSX laptop to Backblaze B2 via Restic using a launchd script. Backups run every hour when the laptop is awake. This works great for me and is really efficient as I’ve got my excludes and includes set to keep changes to a minimum, as such most backups have either no files changed or only ~20 or so.

I currently don’t prune backups but would like to keep hourlys for as long as possible thinning out to dailys, weeklys, monthlys to yearlys etc.

What I’m wondering is, is there a maximum amount of snapshots I should try to keep under to keep any sort of repo performance? Does the number of snapshots matter or is it more about overall repo size?

Without any specific basis for it, I’d say you don’t have to worry about the number of snapshots. Just make a sane retention policy that only keep what’s necessary (e.g. every hours last week, every day last few months, every week last year, every month last few years - this should have you covered really well IMO, but it of course depends on your specific use case).

There is a performance implication when having a large number of snapshots: Most commands need to read all snapshot files to work.

This even applies to commands where it is not obvious. E.g. when backing up without --force or --parent (which are usually not set), restic reads all snapshot files to determine which parent snapshot to use - which in turn speeds up the backup a lot.

However, restic also locally caches snapshot files, so even having many snapshot files may still be ok. You can easily test this by checking if restic snapshots is too slow for you.

In my experiences a total of some hundreds to a few thousands of snapshots is working pretty well.

Just to chime in, i regularly have thousands of snapshots and it works fine :slight_smile:

Awesome, thanks so much for taking the time to reply all!

1 Like