A Backup Is Not a Restore: How to Run a Real Recovery Drill

Most backups are never verified — until the day they're needed and don't work. Here are the three ways backups fail, the 3-2-1 rule, database consistency gotchas, and a quarterly restore drill you can copy, report included.

"We have backups" and "we can restore" are two different claims. What sits between them is a restore drill nobody has ever run.

I've walked into this scene too often: the backup job runs, every log line says success, and on the day it matters the archive turns out to be empty, missing the one critical table, or sitting on the same dead disk as the origin.

Three ways backups fail

  • They aren't running at all: the job started failing months ago, and nobody checked exit codes. A cron that fires is not a backup that succeeded.
  • They're incomplete: files backed up, database not; or uploads, config, cron jobs and private keys quietly skipped.
  • They don't restore: files exist but versions mismatch, dependencies are missing, permissions break — or the backup shares a disk with the origin.
There is only one test: when was the last successful restore drill, and how long did it take? If you can't answer, you don't have a backup.

Set the rules first: 3-2-1, RPO and RTO

  • 3 copies: production plus at least two backups.
  • 2 media types: local snapshots plus object storage — don't rely on provider snapshots alone.
  • 1 offsite: different region or account, so a deletion or account-level incident can't take both.
  • RPO (how much data you can lose): sets your backup frequency. Daily incrementals mean up to a day of loss.
  • RTO (how long you can be down): sets the restore method, and how fast the drill must be.

Database specifics

Files are copy-and-forget. Databases are not — copy data files mid-write and you'll likely hold an unusable snapshot.

# MySQL / MariaDB: consistent single-transaction dump
mysqldump --single-transaction --quick --routines --triggers \
  -u backup -p dbname | gzip > db_$(date +%F).sql.gz

# PostgreSQL
pg_dump -Fc dbname > db_$(date +%F).dump

# Always read the exit code — don't hide it behind &&
mysqldump ... ; echo "exit=$?"
  • Use a consistency flag like --single-transaction so you don't dump half-written rows.
  • For point-in-time recovery, retain binlog / WAL long enough to cover your RPO.
  • Compress and checksum (sha256); spot-check decompression periodically.
  • Give the backup user read-only rights; keep credentials out of the script itself.

The quarterly drill: a flow you can copy

  1. Define the target: full site usable, or just one table recoverable — be explicit.
  2. Prepare an isolated environment: a fresh box or separate directory. Never practise on production.
  3. Restore only from backup media. Syncing from production means you tested nothing.
  4. Run the restore from the runbook, timed end to end, with no improvisation.
  5. Verify against a checklist: homepage loads, admin login works, row counts match, the newest record exists, uploaded images render.
  6. Record the result: elapsed time, snags hit, and what the runbook must change.
  7. File the report with one of three verdicts: pass / conditional pass / fail. A fail gets a dated remediation item.
A drill that fails isn't bad news — it's the drill doing its job. Failing on the actual bad day is the disaster.

Three lines every backup script is missing

  • Alert on failure: check the exit code and notify. Logs nobody reads don't count.
  • Log success too: record the file list and sizes so a backup that quietly shrinks stands out over time.
  • Prune on a schedule: define retention (30 days is typical) or your backups will fill the disk — a common outage in its own right.
#!/bin/bash
set -euo pipefail
D=/data/backup; mkdir -p "$D"
F="$D/db_$(date +%F).sql.gz"
if ! mysqldump --single-transaction -u backup -p"$PW" dbname | gzip > "$F"; then
  echo "backup FAILED" | mail -s 'backup failed' you@example.com; exit 1
fi
ls -lh "$F" >> "$D/history.log"
find "$D" -name 'db_*.sql.gz' -mtime +30 -delete

When to bring someone in

If you can't answer "when was the last restore drill and how long did it take", it's worth ¥100 to have the backup setup reviewed end to end. Managed ops from ¥80/month covers daily incremental plus weekly full backups with offsite retention, and a quarterly restore drill with a written report.

→ 中文版

Still stuck? Hand it to someone who watches servers daily

Remote diagnosis at ¥100 per case — root cause and a plan within 2 hours. Or hand it over on a managed plan from ¥80/month and take "site is down" off your list for good.

WeChat xiexbb · Telegram @kevinxie2008 · Remote-first, bilingual (ZH/EN)

Keep reading