restic 0.19.1 compiled with go1.26.5 on darwin/arm64
I run scripted backup plans to three separate repos. I find three subdirs in my cache directory. Each subdir has a uuid name. Is there a way to figure out which subdir corresponds to which repo?
Reason: I wish to aggressively trim cache directories for repos on my LAN, but not for cloud repos. Running a restic command with --cleanup-cache isn’t aggressive enough: the cache is still very large.
Thanks.
Any restic command shows first characters of repo ID e.g.:
$ restic list snapshots
repository abcd1234 opened
Cache directories’ names correspond to these IDs, for example:
$ ls -1 ~/Library/Caches/restic
abcd1234..... <--- cache for above repo is here
xyzw5678.....
CACHEDIR.TAG
To get full ID run restic cat config:
$ restic cat config
repository abcd1234 opened (version 2, compression level auto)
{
"version": 2,
"id": "abcd1234.............",
"chunker_polynomial": "xxxxxxxxxxxxxx"
}
but first 8 characters should be good enough.
Thank you, that worked great, and I can even use jq to pull the id out of restic cat config in a shell script.
What would be helpful to me is if there was an environment variable to specify --no-cache. I use env files, one per repo, to control the various parameters like block size, URL, etc (my password manager can inject secrets from my vault using these files, so it provides security too). It would be very convenient to add something like export RESTIC_NO_CACHE=true to the env files for the repos on the LAN.
In the meantime, I will add --no-cache to the wrapper scripts that manage those repos.
Thanks again.
Well, I just found out the hard way that running without a cache, even on a LAN repo, is painfully slow. I guess I’ll have to live with the space taken by the cache.
Thanks.
This may also work for you: Use separate directories for the caches which you want to keep vs the ones you want to discard. My personal script for restic sets a variable for the directory where I want the cache to be stored. You could set a directory like /cache_keep and /cache_deleteme for the stuff to keep and the stuff to delete. I have used the phrase deleteme only for things which can deleted at any time without worry. It comes from Alice in Wonderland’s phrases “eat me” and “drink me”.
Thanks. Unfortunately, I don’t know restic well enough to know which caches I need vs. which I don’t. I tried deleting them per repo and then using --no-cache on restic commands to prevent them from refilling, but backups, forgets, and prunes became incredibly slow.
I ended up setting the cache directory to an external SSD so it doesn’t take up space on my internal drive, and running only one forget/prune per repo per day to speed up peak hour backups. That seems to work.