Exclude not excluded?

I am doing a backup, and I have this option

–exclude ‘/home/marky/.cache’

I also use this option

–exclude-caches

Yet, my backup will occasionally throw an error

error: lstat /home/marky/.cache/BraveSoftware/Brave-Browser/Default/Cache/Cache_Data/8d67a36722250dec_0: no such file or directory

It’s always a brave cache folder that triggers an error. Not every backup but every few days now, it only recently started. But all these cache folders should have been excluded.

Please post your FULL backup command.

Not just some flags.

args+=(“-o s3.connections=2”)
args+=(“–exclude=$HOME/.local/share/Steam”)
args+=(“–exclude=$HOME/Games”)
args+=(“–exclude=$HOME/ollama_models”)

restic backup
–compression max
–exclude-caches
–one-file-system
–cleanup-cache
–read-concurrency=20
–exclude ‘$HOME/.local/share/PrismLauncher’
–exclude ‘$HOME/.local/share/baloo’
–exclude ‘$HOME/StabilityMatrix/Models’
–exclude ‘$HOME/Library’
–exclude ‘$HOME/snap’
–exclude ‘$HOME/.Trash’
–exclude ‘$HOME/.local/share/Trash’
–exclude ‘$HOME/.bundle’
–exclude ‘$HOME/.cache’
–exclude ‘$HOME/.mozilla/firefox//Cache’
–exclude '$HOME/.thunderbird/
/ImapMail’
–exclude ‘$HOME/.config/Code/CachedData’
–exclude ‘$HOME/.config/Code/CachedExtensions’
–exclude ‘$HOME/.config/Code/logs’
–exclude ‘$HOME/.config//Cache’
–exclude '$HOME/.config/
/GPUCache’
–exclude ‘$HOME/.config/*/ShaderCache’
–exclude ‘$HOME/.dbus’
–exclude ‘$HOME/.cargo’
–exclude ‘$HOME/.rustup’
–exclude ‘$HOME/.dropbox’
–exclude ‘$HOME/.dropbox-dist’
–exclude ‘$HOME/.local/pipx’
–exclude ‘$HOME/.local/share/Trash’
–exclude ‘$HOME/.npm’
–exclude ‘$HOME/.pyenv’
–exclude ‘$HOME/.thumbnails’
–exclude ‘$HOME/.virtualenvs’
–exclude ‘.tox’
–exclude ‘node_modules’
${args[@]}
$RESTIC_PATH

That only excludes the restic cache folder.

That looks like it should work. Does restic ls <snapshotid> | grep /home/marky/.cache/BraveSoftware list any files?

Which restic version are you using?

From what I read, it will automatically ignore folders that have a CACHEDIR.TAG file in it.

Yes, there are lots of things in the .cache folder even though I specifically excluded it.

I assume this is interpreted by bash, then variables are not expanded in single quotes '. While echo "$HOME" will print /home/marky, echo '$HOME' will print $HOME. So all your excludes don’t match any files (except you have a folder literally called “$HOME”).

2 Likes