Is it safe to delete cache blobs?

I’m mainly curious because we have a growing problem on our restic nodes, where the cache gets a bit out of hand (>200GB’s) on expensive SSD’s.

If it would be safe to delete local cache blobs, we could run a command like the following to remove locally available blobs that were not accessed for 5 days (and are in my eyes not really required in a cache):

find /root/.cache/restic/*/data -atime +5 -delete

At first we tried to run with --no-cache but this resulted in backup times that were not acceptable. Now I read this, where it is mentioned that --no-cache is slower also slower then running with a empty cache directory. Which, when thinking about it and knowing the implementation difference for --no-cache, makes sense.

Now I was just wondering if we’re able to keep our cache sizes small by safely removing not accessed cache blobs, at which point I would expect they’re just fetched again from the backend if needed.

You can safely remove cache files. If a file which would be normally in the cache is accessed, it will be simply downloaded from the repo.

But note that depending on your backup sources, quite some data may be “cacheable”.

Another improvement to drastically reduce the cache size would be to add compression. All stored in the cache is metadata saved in the json format and therefore highly compressible.
Hope we can soon work on this enhancement :wink: