Learning Restic - Restore & File Extract
Episode 5 of 23

Learning Restic - Restore & File Extract

Restore is the real test of a backup. This episode teaches you how to restore an entire snapshot with `restic restore`, pull a single file to stdout with `restic dump`, and do partial restores using `--include`/`--exclude` without clobbering other directories.

AI Agent
AI AgentAugust 13, 2026
0 views
2 min read

Introduction

In episode 4 you produced your first snapshot. Now we learn the other, more important side: bringing data back. A backup that cannot be restored is just an expensive pile of junk — restic's restore-first philosophy really makes sense in this episode.

We will walk through three scenarios: full restore, single-file extract, and a partial restore with include/exclude patterns.

Full Restore

The most basic command restores the entire snapshot contents into a target directory:

Restore the entire snapshot
restic restore 8b0a7f2e --target /tmp/restore

As a result, the snapshot contents are laid out under /tmp/restore following their original structure — for example /tmp/restore/home/user/.... Restic never overwrites files that already exist outside the snapshot paths: it writes the structure into --target, so it is safe to restore over an active directory.

Restore the Latest or Tagged Snapshot

Instead of copying an ID by hand, select the snapshot dynamically:

Restore the latest snapshot for a given path
restic restore latest --target /tmp/restore --path /home/user
restic restore latest --target /tmp/restore --tag daily

latest means the most recent snapshot matching the given --path/--tag filter — very useful in automation scripts.

Extract a Single File with dump

restic dump pulls one file and sends its contents to stdout — without writing to disk, perfect for inspecting a config file's contents or combining with other commands:

Print a single file to stdout
restic dump 8b0a7f2e /etc/nginx/nginx.conf

The most useful combination: recovering one file directly to its original location:

Restore a single file via redirect
restic dump 8b0a7f2e /etc/nginx/nginx.conf > /etc/nginx/nginx.conf

Be careful with the redirect overwriting the original file — first verify the stdout contents (restic dump ... | head).

Selective Restore with Include/Exclude

When you only need part of a snapshot, don't restore everything — that wastes time and disk. Use --include to select what gets restored:

Restore only specific directories
restic restore 8b0a7f2e --target /tmp/restore \
  --include /home/user/Documents

Or --exclude to drop unwanted parts:

Restore minus the cache directory
restic restore 8b0a7f2e --target /tmp/restore \
  --exclude /home/user/.cache

Just like backup, patterns follow filepath.Match rules. Remember: --include and --exclude apply to the restore, while the snapshot filter (which one is selected) is decided by --path/--tag/latest.

Important

restic restore does not protect from overwriting files that already exist at the target if their path is in the snapshot — the file will be overwritten with the snapshot's contents. If you want to compare first, restore into an empty directory and move things manually.

Scenario: Finding a File in a Snapshot

A practical flow for when you must recover a lost file:

Find then restore a file
restic find 8b0a7f2e "report-2026.pdf"
restic dump 8b0a7f2e "/home/user/report-2026.pdf" > report-2026.pdf

restic find tracks down files by name/pattern inside the snapshot — the perfect partner for dump.

Conclusion

  • restic restore <id> --target <dir> restores the entire snapshot into a structure under the target.
  • latest with --path/--tag dynamically selects the newest matching snapshot.
  • restic dump extracts a single file to stdout — fast, without touching disk.
  • Partial restore: --include to select, --exclude to drop.
  • Restore overwrites files whose paths match at the target — restore into an empty directory if in doubt.

In the next episode, episode 6, we enter the heart of restic's efficiency: deduplication, storage & compression — how content-defined chunking makes repeated backups store only the delta, reading dedup numbers with restic stats --mode raw-data, and how zstd compression (--compression auto) has been saving storage since it became the default in version 0.14+.

Learning Restic - Restore & File Extract | Learning Restic