Restic stats on unused size

Is there any way to get info on what is the unused size in a repo (ie the ‘unused size after prune’ output) but without actually removing snapshots/running a prune. I am thinking only running a prune when the repo is more than 50% full of unused.

I tried stats raw data but I think that percentage is (sum of all snapshots used in repo) / (sum of all snapshots) which doesn’t seem to match what I had in mind

Hello,

Restic prune can be executed in dry-run, and gives you exactly what you want.

# restic prune -n
repository 9478621b opened (version 2, compression level auto)
loading indexes…
[0:02] 100.00% 114 / 114 index files loaded
loading all snapshots…
finding data that is still in use for 637 snapshots
[7:52] 100.00% 637 / 637 snapshots
searching used packs…
collecting packs for deletion and repacking
[0:00] 100.00% 3392 / 3392 packs processed

Would have made the following changes:

to repack: 235785 blobs / 1.788 GiB
this removes: 5013 blobs / 631.157 MiB
to delete: 845 blobs / 90.089 MiB
total prune: 5858 blobs / 721.245 MiB
remaining: 655141 blobs / 37.295 GiB
unused size after prune: 1.864 GiB (5.00% of remaining size)

Anyway you could probably just execute a real prune with –max-unused 50%, so that it will stop pruning at 50%.

1 Like

What might also be interesting is that you can check how much space would be freed by deleting certain snapshots by using restic forget --dry-run --prune ...

1 Like