Does spreading out --max-unused make any difference?

restic 0.19.1 compiled with go1.26.5 on darwin/arm64

For simplicity, assume one backup a day, followed by a run of restic forget --max-unused [ value ] --prune. In order to satisfy the --max-unused parameter, restic must download some data from the repository. I understand why that needs to happen.

My question is this: suppose I use --max-unused unlimited 6 days a week, but on the 7th day, I specify --max-unused 0. Does this make any difference in how much data must be downloaded over several weeks? Instead of using --max-unused 0 every day?

Reason for question: I use cloud storage for the repo; I would like to optimize for minimum storage and minimum download bandwidth.

Thank you.

over several weeks the total amount prune has to read is basically the same. unused space still accumulates, day-7 with --max-unused 0 just pays for all of it in one hit.

so you dont really save download bandwidth by spreading unlimited/0 like that. you mostly change when the spike happens (one fat prune vs smaller daily ones).

if you care about cloud egress, something like --max-unused 5% (or 10%) every day is usually less painful than weekly 0. unlimited all week then 0 is the spikiest option.

storage side: unused packs sit around until that strict prune, so average bytes stored is a bit higher with the 6+1 pattern too.

Actually this is not completely true.

There are two cases when snapshots are removed (by forget):

  • Completely unused pack files → Those are always removed by the next prune run (which doesn’t need to read/download anything)
  • Partly used pack files, i.e. packs where blobs which are used and blobs which are no longer used → These packs can be repacked to remove the unused blobs. And for this, the --max-unused option can reduce repacking.

It is true that --max-unused 0 will repack all party used pack files. The advise is to set it to some percentage of the total repo size, e.g. 5%.

About the original question:

It can be that a weekly --max-unused 0 does need to download all partly used packs and hence this is just shifts the point in time when the repacking happens compared to a daily --max-unused 0.

However, it can also be that a daily --max-unused unlimted (or some high enough value) will not repack a partial used pack, but during the week (and more removed snapshots), this partial used pack turns into a unused pack and will be removed without the need to read it at all.

So, as with all complex situations, the answer is: It depends :slight_smile: