$32
$33
Prerequisites
- A Linux or macOS machine to back up. Restic works on Windows too, but the setup is more painful-use WSL2 if you're on Windows.
- Restic 0.16+. Older versions have known issues with the S3 backend and concurrency.
- A place to store backups. Local disk works for testing; production needs off-site. S3, B2, and GCS all have free tiers or near-free tiers for small backups.
- root/sudo for backing up system files. User-level backups don't need root.
- A password manager. Your repo password is the single point of failure-if you lose it, your backups are unrecoverable. Store it somewhere you trust.
- cron or systemd, for automation.
$34
$35
$36
$37
Snapshots and Diffing
# List all snapshots
restic snapshots
# Compact view
restic snapshots --compact
# Filter by host/tag/path
restic snapshots --host web-01 --tag daily
# Show what changed between two snapshots
restic diff 8c7d9e2f 4a5b6c7d
# Show files in a specific snapshot
restic ls 8c7d9e2f
# Find a file across all snapshots
restic find report.pdf
The restic diff output is what you'll use most when debugging "did last night's backup actually capture the change I made?":
+ /home/alice/documents/2024-q4-report.pdf
- /home/alice/documents/temp-draft.pdf
M /home/alice/projects/myapp/README.md
+ added, - removed, M modified. Use this when a user reports "I deleted a file yesterday and want it back"-find the snapshot before the deletion.
$38
$39
$3a
$3b
$3c
$3d
$3e
$3f
$40
$41
$42
Conclusion
Restic is the backup tool that gets out of your way. Set it up once with a systemd timer, point it at B2, add monitoring, test your restores quarterly, and you can stop thinking about backups for years. The setup takes a weekend. The peace of mind lasts forever.
The two things that will bite you if you skip them: never testing restores (a backup is a hypothesis until you've restored from it) and never running prune + check (the repo silently grows and silently corrupts). Schedule both. Add monitoring that screams if either fails. Then you have backups.
Originally published on Mango Developer.
Top comments (0)