Include Exclude and Files From
Scope control reduces storage cost and makes restores faster and less confusing.
Quick Summary
Back up what you can restore confidently. Exclude caches and rebuildable files so snapshots stay clean.
What Usually Should Not Be Backed Up
| Path type | Examples | Why |
|---|---|---|
| Caches | .cache/, app caches | rebuildable |
| Dependencies | node_modules/, vendor dirs | reinstallable |
| Build output | dist/, build/ | reproducible |
| Large temp data | tmp dirs | noise + cost |
Exclude Common Noise
restic backup /srv/app \
--exclude ".cache" \
--exclude "node_modules" \
--exclude-file /etc/restic/excludes.txt
Example exclude file:
/etc/restic/excludes.txt
.cache
node_modules
tmp
*.log
Use Files-From for Deterministic Sources
restic backup --files-from /etc/restic/files-from.txt --tag daily
Example files-from list:
/etc/restic/files-from.txt
/srv/app
/etc/nginx
/var/www/media
Best Practices
- Use
--files-fromfor production jobs so your source list is explicit - Keep
excludes.txtin your runbook repo so changes are reviewed - After changing excludes, run a small restore test