Skip to content

Lesson 11 of 13 · 15m

The Restore Test Nobody Runs

GitLab's five backup mechanisms all failed at once because none had ever been restored; drills turn hypotheses into facts.

The most reliable sentence in disaster recovery is that the first restore attempt happens during the outage. Backup monitoring watches the writer; restore testing exercises the reader — and the reader is the product. The verification ladder has four rungs, and most setups stop at the first.

The ladder

  1. Artifact existence. The snapshot is listed (restic snapshots), the dump file is non-zero, the WAL archive is filling. Minimum viable check — catches the empty-dump class — and not sufficient alone.
  2. Integrity. restic check verifies the repository structure; restic check --read-data-subset=10% samples actual pack contents against their hashes. pg_restore --list dump.pgc parses the archive header and table of contents — this single command would have caught GitLab's silently-empty pg_dump artifacts, months before they were needed. sha256sum comparisons, gzip -t on compressed dumps, borg check. Cheap, schedulable, catches corruption near write time.
  3. Functional restore. Restore to a scratch VM or container, boot the service, run the app's own smoke checks. This is the only rung that tests the full chain — dump format, WAL replay, schema load, app compatibility — and the only one that answers "does the service actually come back." One hazard nobody prices in: a functional restore boots a clone of production, and a cloned cron job will happily send real email and hit real third-party APIs. Drills belong on a no-egress namespace or against stubbed integrations — otherwise your restore test pages your customers.
  4. Timed. Record the wall clock. Restore duration is the empirical RTO input; a drill that takes 9 hours against a 4-hour RTO is a failed test with green artifacts.

The evidence: GitLab, again

The January 2017 incident earns a second citation because it is the canonical restore-testing failure. Five mechanisms existed on paper. The pg_dump backups in S3 were empty — generated by 9.2 binaries against a 9.6 database — and the failure was invisible because nobody ran pg_restore --list on what they were shipping. Azure snapshots covered the wrong servers. LVM snapshots were stale. Replication was already broken. Each layer was a plausible checkmark in a review; none had ever produced a running system. The team discovered all of it live, on a livestream, while restoring the site.

There is a quieter version of this in every shop: the backup that stopped covering a new table, a new volume, a new service — because the job was configured in 2022 and the system grew around it. Restore testing catches coverage drift too, because a restore of an incomplete artifact boots a broken service, which is a loud signal.

The pattern to internalize: the failure modes were all at restore time. The writers all ran fine. Backup systems are green by construction and broken by default; only restores reveal which.

Wrong model: monitoring the exit code

"Cron mailed success" and "the monitoring shows the job ran" describe process completion, not artifact viability. Exit 0 with a zero-byte artifact is the exact failure shape of the most common backup disaster. Monitoring must assert on the artifact: size sanity (dump today ≈ dump yesterday ± growth), repo check output, and drill results.

The practice

Automate it. A scheduled pipeline — CI job or a cron on the backup host — that picks the latest snapshot, restores to an ephemeral target, boots, checks, logs duration, and pages on failure. Two details that make drills honest: restore a random snapshot sometimes, not always latest — an incremental chain or a retention-pruned gap only shows up when you pick an older point — and keep a drill log with duration, artifact id, and result, because "we test restores" without records is another rumor. Monthly minimum for functional restores; integrity sampling weekly is cheap enough to be automatic. Once a quarter, the full dress: whole stack restored to clean VMs, timed end to end, results written next to the RTO you promised. A backup unverified this quarter is a hypothesis; a backup verified is still just one data point — but at least it's an honest one.

Was this lesson helpful?

Sign in to rate

Keep reading

Related articles from the SudoSecurity blog.