Skip to main content

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 typeExamplesWhy
Caches.cache/, app cachesrebuildable
Dependenciesnode_modules/, vendor dirsreinstallable
Build outputdist/, build/reproducible
Large temp datatmp dirsnoise + 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-from for production jobs so your source list is explicit
  • Keep excludes.txt in your runbook repo so changes are reviewed
  • After changing excludes, run a small restore test