A restic backup that exits cleanly is not proof your data is in the snapshot. It is proof that restic finished — which is not the same thing.
The call I get is always some version of the same one. The nightly job has been green for months. Then someone tries to restore a database, or a directory of client files, and it is not there. Nobody changed the backup script. The dashboard is a wall of ticks. And yet the thing you needed is missing from the snapshot. This happens because restic, quite reasonably, treats “I could not read that” and “you told me to skip that” as normal events, not failures — and both get written to output you stopped reading a long time ago. Here is how to find out what a snapshot actually contains, and the four causes worth checking first.
First, audit what the snapshot actually holds
Do not reason about it. Look. Restic gives you two commands that settle the question directly, and neither touches the running backup. restic ls lists the files inside a snapshot, and restic diff shows exactly what changed between two of them.
Point restic ls latest at the path you expected to recover and confirm it is there. Then run restic diff between the last two snapshots. In the diff output, + means an item was added, - means it was removed, M means content changed, U means metadata changed, and T means the type changed. A run of - lines against a directory you never deleted is the tell: the files did not leave your disk, they left your backup. That single diff usually points straight at the cause.
The four ways files vanish quietly
1. An over-broad exclude. This is the most common by far. Restic exclude patterns match on complete path components, and an unanchored pattern matches anywhere in the tree. The pattern data does not just match some folder you had in mind — it matches /var/lib/postgresql/data too. And once a directory is excluded, restic will not descend into it: everything underneath is gone with it. A tidy-looking --exclude written to skip a build cache can silently swallow a database.
2. --one-file-system stopping at a mount. The --one-file-system flag (short form -x) tells restic not to cross filesystem boundaries. If the thing you care about lives on a separate mount — a data volume at /srv/data, an attached disk, a bind mount — restic reaches the mount point and stops, by design. The backup of / looks complete because restic did exactly what you asked. You have to name each filesystem you want on the command line.
3. Permission denied, buried in the log. When restic cannot read a file, it does not abort. It prints a warning, counts the read errors, writes an incomplete snapshot of everything it could reach, and exits with code 3. If your job runs as a user that cannot read part of the tree, or an ACL blocks it, those files are missing and the only sign is a warning line and a non-zero exit you are not checking.
4. A live file captured mid-write. Restic backs up what the file looks like at the instant it reads it. A database file copied while the engine is writing to it is present in the snapshot but internally inconsistent — useless on restore. The file is there, so restic ls will not flag it. This one you catch by backing up a dump or a proper snapshot of the volume, not the live data directory.
Audit and fix, end to end
# --- Audit: what is actually in the snapshot? (restic 0.17) ---
restic snapshots
# List a path you expect to recover, inside the newest snapshot
restic ls latest /var/lib/postgresql
# Compare the previous snapshot with the latest to spot silent losses.
# Lines beginning '-' are items that left the backup.
prev=$(restic snapshots --json | jq -r '.[-2].short_id')
restic diff "$prev" latest
# --- Re-run the backup and this time READ the outcome ---
restic backup /srv /var/lib/postgresql
--exclude-file=/etc/restic/excludes.txt
--verbose
code=$?
# 0 = clean, 3 = some source files could not be read (incomplete snapshot)
if [ "$code" -eq 3 ]; then
echo "WARNING: restic could not read every file — snapshot is incomplete" >&2
fi
exit "$code"
And the exclude file that caused half the trouble — anchor the patterns so they only bite where you mean:
# /etc/restic/excludes.txt
# WRONG: unanchored, matches a 'data' component anywhere,
# including /var/lib/postgresql/data
# data
# RIGHT: a leading slash anchors the pattern to the backup root
/srv/build/cache
/srv/*/node_modules
# Extension globs are fine; they are meant to match at any depth
*.tmp
For the mount problem, list each filesystem explicitly rather than trusting -x to guess: restic backup / /srv/data --one-file-system. For the live-database problem, back up a consistent dump — a pg_dump or an LVM/filesystem snapshot — instead of the running data directory.
Read the exit code, not the colour of the output
The reason these failures stay hidden is that most backup wrappers treat any completion as success. Restic is more precise than that. Exit 0 is clean; 3 means it could not read some source data and the snapshot is incomplete; 1 is a general failure; and since 0.17 there are dedicated codes for a missing repository (10), a failed lock (11) and a wrong password (12). A job that discards the exit code and colours the run green on a zero-length stderr is throwing away the one signal that tells you the backup is short.
Treat the backup like any other pipeline you would not ship untested. The same discipline that makes a pre-commit baseline actually run in CI applies here: check the exit code, fail loudly on 3, and run a periodic restic diff as an automated assertion that the snapshot still contains what it did last week. Recovery is one of the numbers a resilience programme has to be able to evidence, and it belongs alongside the other operational metrics you already instrument — because time-to-recover means nothing if the thing you restore is missing a third of the files.
A backup you have never restored from is a hypothesis, not a control. The snapshot that fails you will be green right up to the moment you need it.
Free interactive tool
Website compliance checklist
What your site has to do, based on what it actually does
Answer as much or as little as you like — the list builds as you go. Nothing is stored against your name and no email is required.
Everything that applies
Ordered by what to do first: legal requirements you can close quickly, then larger pieces of work, then what is expected rather than required. Not exhaustive, and not a legal audit.
Dated PDF, yours to keep or circulate.
Free interactive tool
Interactive deadline calculator
Check which regulations apply to you and when
Regulation across the EU, UK, US and Asia-Pacific has moved considerably in the past eighteen months, and several headline dates have shifted more than once. Twelve questions, about three minutes.
Results are shown on screen — no email required. A dated summary is available to download, and can be sent on if that's more useful. What we do with your answers.
Most technology problems are not technology problems. They are control problems.
The systems exist. The investment has been made. The question is whether leadership can understand, direct, evidence, and sustain what those systems produce. Find out where control exists — and where it only appears to.
Full Governance by Sixteen Pillars
Govern your business. Prove your compliance.
A board assurance cockpit for EU-regulated financial firms — tamper-evident, hash-chained proof of governance across DORA, GDPR, NIS2, ISO 27001, the EU AI Act and MiCA. In development.
See what's coming