Lesson 8 of 14 · 20m
Backups that actually restore
3-2-1 with restic and rsync, database dumps instead of file copies, and the quarterly restore drill that proves it works.
A backup that has never been restored is a hypothesis, not a backup. The wrong mental model is "we have snapshots" — snapshots live in the same failure domain as the data: same VG, same hypervisor, same cloud account, same credentials. When GitLab lost six hours of production data in January 2017, their postmortem listed five backup mechanisms that all silently weren't working, and the one that saved them was stale. When OVH's Strasbourg datacenter burned in March 2021, every "backup" stored in the same building went with it.
What to back up
Enumerate before you copy: /etc, application state under /var/lib, user data, databases, and the cron/timer and systemd config that defines the box. A database gets dumped — pg_dump, mysqldump, or WAL archiving via pgBackRest/wal-g — because copying a running database's data files gives you corrupted files that look like a backup. Config-management repos don't count if the secrets and TLS material aren't in them.
3-2-1, stated concretely
Three copies, two different media or failure domains, one off-site. On real infrastructure that reads: live data, a local copy on different storage, and an encrypted copy in another provider or another region. restic gets you encrypted, deduplicated, versioned backups to S3-compatible or sftp targets in three commands:
restic -r s3:s3.us-east-va.io.cloud.ovh.us/backups init
restic -r s3:s3.us-east-va.io.cloud.ovh.us/backups backup /etc /var/lib/app --exclude-caches
restic -r s3:s3.us-east-va.io.cloud.ovh.us/backups snapshotsFor a quick filesystem replica, rsync -aHAX --delete src/ dst/ preserves permissions, hardlinks, ACLs, and xattrs — --delete makes it a mirror, so understand that a deleted source file is deleted at the destination too. Snapshots or restic are the versioned answer.
Retention and what to skip
A backup that keeps everything forever is a disk-fill incident on a schedule. restic forget --keep-daily 7 --keep-weekly 4 --keep-monthly 6 followed by restic prune applies a retention policy the same way logrotate does for logs. And exclude deliberately — /proc, /sys, /dev, /run, container image layers, and anything covered by --exclude-caches are bytes you'd pay to store twice while never being able to restore them usefully.
Schedule it like a service
A systemd timer beats a cron line because failures land in the journal. Monitor the job itself — a backup that silently stopped three weeks ago is worse than none, because it changed your risk model while changing nothing on disk. systemctl list-timers shows when it last fired; wire a dead-man's check (a healthchecks.io-style ping on success, alert on silence) instead of trusting "last ran fine."
The restore drill
Quarterly: pick a file, a directory, and a database; restore them to scratch space:
restic -r s3:.../backups restore latest --target /tmp/restore --include /etc/ssh/sshd_config
pg_restore -d scratchdb /backups/prod-$(date +%F).dumpTime it. The number you get is your recovery time's lower bound, and it is always longer than anyone assumed. If the drill is painful, write the runbook entry you wished existed — that document is the real deliverable.
The part nobody budgets for
Backups are free until restore day; restores are where the cost lives. Write down who can reach the repo credentials, where the encryption key is escrowed (a password manager vault someone else can also open, not one person's laptop), and the rough order of restore — identity store first, then databases, then app state, then everything else. An undocumented recovery is a recovery that happens at 3 a.m. by whoever guesses fastest.
Pitfalls
- Backups encrypted with a key stored on the same box — or restore credentials that live only in the incident channel you'll lose.
- Dumping the database into the directory you back up, then never testing that the dump loads.
- Snapshots mistaken for backups: a RAID mirror or LVM snapshot replicates corruption and deletion faithfully, instantly.
tar/rsyncover a live database without a dump or freeze: the copy is mid-write garbage.- Backup jobs that alert on failure but run on the same host they're protecting.
Was this lesson helpful?
Keep reading
Related articles from the SudoSecurity blog.
Self-Host OpenClaw: VPS Setup to Production (2026)
Self-host OpenClaw from zero to production. Server provisioning, SSH lockdown, Docker, reverse proxy, Fail2ban, performance tuning, and full backup strategy in one guide.
Zero Trust Everything: The Complete Guide to Self-Hosting Teleport for Secure Infrastructure Access
SudoSecurity runs Teleport internally for everything — admin panel access, secure database connections, Kubernetes, and zero-trust philosophy across our entire team. This is the complete technical guide to installing, configuring, and running your own self-hosted Teleport cluster from scratch.
Red Hat Called This Bug a 5.9. Two Weeks Later It Was a 9.8.
CVE-2026-98432 is a use-after-free in the IPv4 TCP handshake, reachable by anybody who can reach a listening port, sitting in the kernel since 4.4. Red Hat scored it 5.9 moderate and deferred the fix. Then 8.1. Then 9.8.
Self-Hosting Vaultwarden Without Trusting the Defaults
Vaultwarden gives you a Bitwarden-compatible password server in one container and about ten minutes. The defaults that make that possible leave org creation open, audit logging off, accounts on PBKDF2, and a rate limiter that trusts a header anyone can set.