Let’s describe the use-case I am trying to solve:
I do very frequent snapshots of my ~
and regular snapshots of /
. I have a small disk I backup to, but I can do this because of restic’s awesome deduplication (Thanks for an awesome tool!). My retention periods are --keep-within 2d --keep-daily 14 --keep-weekly 16 --keep-monthly 18 --keep-yearly 3
Sometimes I have larger files I download but only keep for a while. For example compressed multi-gigabyte log dumps, steam games I only play for a while, iso images (sparse, but anyways).
I excluded my steam games(*) since they can easily be redownloaded and don’t need a backup but for some files. If I think of it, I abuse an exclude for downloads that I don’t want in my backup. (I could also make a separate Downloads-nobackup
folder.)
But I don’t know that for everything before I allocate disk space to it, or I just forget it will be backed up. So there is probably are probably huge files in some snapshots that are irrelevant but were only there for a week or two. If I am lucky my retention will just get rid of it eventually but if I am unlucky a unnecessarily large snapshot will end up as “monthly” snapshot and last quite a while.
If I know the files name I could probably use restic find
but I was looking for a way to find unknown large files (or directories).
I have two approaches in mind:
- Using
restic diff
I could check if there is a spike in added space somewhere but that doesn’t mean it was removed at another point. - looping over every snapshot, every tree, every subtree, every file and comparing content blob strings if some only appear in a handful of snapshots.
Do you have any other ideas how to approach this? Is this maybe something somebody already did? Is this something interesting for more people than just me? Is this something restic would like to manage itself? If this is something totally alien to you, how could I approach a solution for myself; like how should I program it?
(*) Actually I excluded the entire steam directory instead of just the steamapps which I regreted recently due to a steam issue and the need to restore my steam config. Recent Steam bug