Restic files in ubuntu filesystem /root/.cache

restic seems to be creating directories in my ubuntu laptop in the following location:

/root/.cache/restic/9077b004ea0fef163a6d6c305a211602eea3de1dac07613b8dec6bf93fe922e6/

Underneath that are sub directories for:

data
index
snapshots

These appear to go back all the way to the start of the restic installation. The ‘data’ directory is the largest with nearly 6.2gb and it’s filling up my ‘filesystem root’ to a dangerous level. Underneath the data directory are lots of directories with 2 character names which look like binary representations. Within each directory are files which are marked as ‘type : binary’. Please can someone explain what these are and how can I remove them safely or relocate them. Thanks in advance.

Hi :wave:
This is cache directory which has cached repository content, which used to speed up operations.
It is safe to delete, but be aware that the user you run seems to be root which will re-put the needed files under the same cache folder again on next run. It is of course unless you run the restic command with --no-cache.

You can also try adding --cleanup-cache to the commands instead so it would tidy up the cache folder and remove unused data inside it.

1 Like

Thanks very much for your response. Some more questions please:

  1. You say that the cached repo is used to speed up operations. Is this from one backup to the next i.e. all the OLD ones are not required or is it some sort of progressive cache where new info is added into the new directories but the old info is still required?

  2. Is there any way of moving the cache to another location where there is more space?

  3. What would happen if I removed the restic directory in total from /root/.cache?

Thanks again for your prompt help.

See Manual — restic 0.16.4 documentation for more details on the caching in restic. The cache currently only stores data that is also available in the repository, that is you can delete it whenever you want. The next restic run will rebuild the cache though, unless you disable the cache explicitly.

1 Like

So if my backup is always to a local drive (that gets replicated to other locations) is there any reason why I shouldn’t run with --no-cache?

Thanks

The cache provides no benefit if the repository is also stored locally.