--exclude-caches


#1

how the --exclude-caches works?


#2

From restic help backup:

excludes cache directories that are marked with a CACHEDIR.TAG file

This means restic will skip over any directory that contains a file with the name CACHEDIR.TAG, regardless of the file’s contents. Some software will create such a file in their cache directories specifically to indicate that the directory does not need to be backed up, but other software does not know about this practice. Therefore, you may still need to explicitly --exclude cache directories (like /var/cache on Linux).


#3

Ah, that’s not exactly right, it needs to have the correct content: http://www.bford.info/cachedir/spec.html


#4

Ah, THAT’S where it comes from! I was wondering how the heck the “CACHEDIR.TAG” stuff works. Thanks for the link.


#5

Oh, hm. I wasn’t aware that this isn’t known widely…maybe we can find a good spot to add a link to the docs…


#6

It is important respect the specs, otherwise:

uploaded intermediate index 10d1bf4a
uploaded intermediate index 3e51b5b9
uploaded intermediate index 0b75cb08
invalid (too short) signature in exclusion tagfile "/usr/home/xxxxx/www/wp-content/uploads/snapshots/CACHEDIR.TAG"
invalid (too short) signature in exclusion tagfile "/usr/home/xxxxx/www/wp-content/uploads/snapshots/_backup/CACHEDIR.TAG"
invalid (too short) signature in exclusion tagfile "/usr/home/xxxxx/www/wp-content/uploads/snapshots/_locks/CACHEDIR.TAG"
invalid (too short) signature in exclusion tagfile "/usr/home/xxxxx/www/wp-content/uploads/snapshots/_logs/CACHEDIR.TAG"
invalid (too short) signature in exclusion tagfile "/usr/home/xxxxx/www/wp-content/uploads/snapshots/_logs/_sessions/CACHEDIR.TAG"
invalid (too short) signature in exclusion tagfile "/usr/home/xxxxx/www/wp-content/uploads/snapshots/_restore/CACHEDIR.TAG"
uploaded intermediate index 1a7d7e3e
uploaded intermediate index 7e29b1b8
uploaded intermediate index e43bd144

Those files are empty:

# cat /usr/home/xxxxxx/www/wp-content/uploads/snapshots/CACHEDIR.TAG
#

#7

There is the workaround of --exclude-if-present CACHEDIR.TAG, but that may be a bit too risky…