In my repository I have different pack sizes: ~ 4 MB (probably an old default?), ~16 MB (the current default) and ~ 64 MB (set by me). The repository is 1.8 TB and has over 220k packs.
I would like to repack the 4 MB packs to 64 MB (because there are so many) but leave the 16 MB packs as they are (because that’s also a reasonable size). I guess restic prune --repack-small will repack all below 51.2 MB (80 % of current pack size setting). So I am looking for something like --repack-smaller-than 14M.
Is is possible to have a repack threshold lower than the target pack size?
Looking at the repack logic at prune.go, more precisely at decidePackAction(), there is a comment that states that smaller packs are repacked first.
Maybe some more experienced users can confirm, but it seems that if you run restic prune --repack-small --pack-size 64 --max-repack-size X, where X is the size in MB of all your < 16 MB packs together, you should be able to do what you want.
Thanks for looking that up! I figured out that the smallest packs are the oldest from a v1 repository (uncompressed). So if I use --repack-uncompressed, the smallest packs disappear and new 64MB packs are created, because the oldest packs are uncompressed and small. I am already using --max-repack-size because it would take too long to repack all in one go (about 30 hours for all and perhaps 15 hours for those < 10 MB).
Good to know that restic starts with the smallest packs!
Well, thanks for the clarification. That comment, while being technically correct, can be easily misunderstood. If I understand the code correctly, when using --repack-small small packs (<80% target pack size) are repacked like 100% unused packs. So in my case 16 MB packs are repacked while 99% unused are not.
In my particular case, using --repack-uncompressed works pretty well. But IMHO, a --repack-smaller-than <size theshold> flag would be a nice feature for repository management.
For the sake of completeness, here is the new pack size distribution and mean pack size is now 41.4 MB. Most small packs have been repacked to 64MB, the 16 MB packs remain.
The set of small packs was not completely identical to the set uncompressed packs, so there are a few small packs left which I can only repack if I repack all the ~16MB packs, too. The log scale shows them: