Globally disable the cache and compression

hello, thanks,

in my case, never want to use cache and compression

so far, i have to add --no-cache to each and every command
and tho that works. if i forget to --no-cache --compression=off, then …

could not find a global flag, or config setting for entire repository.
tried RESTIC_NO_CACHE=true


There is no environment variable to disable the cache globally. My suggestion would be to use a simple wrapper script which always add the --no-cache option.

Out of curiosity, why are you disabling the cache? Unless the repository is stored locally, that will cause a significant decrease in performance.

hi, thanks,

well, the repo is stored on a windows server in the local lan.

all well, very cool, that restic can control the cache, per backup, per snaphost.

fwiw, looking for restic init --no-cache --no compression

The --compression off is a no-op for the init command. You have to specify the compression level to use for every command.

yes, thanks, i do understand that.
sorry, i was not clearer about that.

i was suggesting what i wanted.
to disable cache and compression for the entire repo, when the repo is created.
such a command might look like restic init --no-cache --no compression

or at least some basic global flags


Use RESTIC_COMPRESSION=off, as documented here. :slight_smile:

FYI, rustic supports setting the compression (and other settings, like pack size configuration) globally in the repo config:

rustic init --set-compression 0 
// or, for a existing repo:
rustic config --set-compression 0 

(but note, this only sets the compression when backing up to this repo using rustic, if you use restic to backup you still have to set the compression as argument or env variable)

For the cache, this is not configurable in the repo config and I don’t think this makes much sense as a repo could be accessed from many hosts which may or may not need a cache. So the way for rustic here is to use a config file, see e.g. local.toml. But RUSTIC_NO_CACHE=true is also supported.

BTW, here is the open issue about configuration for restic: Configuration File · Issue #16 · restic/restic · GitHub
This seems to stay an open issue, so I think the way is to use one of the many available wrappers here (or write a script yourself).