field note 018 · 2026-10-15 · backups, disaster recovery
every backup succeeded for 23 days, and none of them left the box
we run infrastructure for a blockchain data-indexing company. in august we found that its off-box database backups had been failing for three weeks while every check said they were fine. this is the whole arc: the silent failure, the fix, a rebuild drill on a throwaway server, and where the recovery point sits now.
how a backup fails quietly
the database box runs postgres and mongodb. five backup scripts copied the nightly postgres dumps and other backups to a google cloud storage bucket. we found the problem on 2026-08-12, by accident, while setting up a different credential for the weekly healthcheck.
all five scripts uploaded as a person. the copy ran under a user login, and google forces user logins to re-authenticate every so often. a cron job can't answer that prompt, so from about 2026-07-20 every upload failed with a reauth error. three things then lined up:
- the error went to /dev/null, so nothing was written down anywhere.
- the script exited 0 regardless, so the dead-man's switch kept getting its "done" ping and stayed green.
- local retention was 14 days, so the oldest local dumps were aging out while nobody had a reason to look.
mongodb was fine the whole time. its backups (Percona Backup for MongoDB, continuous point-in-time) already used a service account, writing to the same bucket. the missing control was sitting right next to the broken one.
what it cost
postgres had no off-box copy for 23 days. by the time we looked, the 14-day local retention had already deleted the dailies from 07-21 through 07-28, so those 8 days are gone. the 15 dumps that were still on disk (07-29 to 08-12, ~12 GB) backfilled in about 40 seconds once the credential worked.
the fix
long story short, backups stopped running as a person. we made a dedicated service account that can create and read objects in the bucket and can't delete them. a compromised database box can add backups and can't destroy the ones already off it. we tested both directions: an upload worked, a delete was denied.
two small surprises on the way. create-only on its own fails, because the copy command checks whether the object exists first, which needs read. and append-only means nothing can be overwritten, so a "latest" file had to become a timestamped one (the bucket's existing 30-day lifecycle rule prunes the old ones).
all five scripts now go through one upload helper that keeps stderr, exits non-zero, and logs a loud "backup degraded, off-box copy missing" line with the error. then we pointed the healthcheck at the bucket itself, and on day one it would have reported three of its four backup checks as dead when they were fine (wrong prefixes, and postgres dumps sitting at the bucket root where a plain prefix lists zero objects). the check needed checking too.
the drill
a backup you've never restored is a guess. on 2026-10-14 we rented an hourly bare-metal server (about $1.09 an hour), rebuilt the whole box onto it from the off-box copies, compared it against production, and deleted it. start to finish took 14 minutes.
| step | time |
|---|---|
| main database restore (16 parallel jobs) | 169s |
| platform database restore | 24s |
| time-series core restore | 13s |
| box ready to 13 of 13 processes online | ~8.5 min |
| read routes matching production | 8 of 8 |
a second copy of production can do real damage if it starts talking to the world, so we cut it off before starting a single app: no tunnel, no VPN, no crons, and a firewall dropping all outbound traffic except our own connection. that firewall earned its keep inside the hour. it caught a write heading to a hosted postgres outside the box, which we traced the next day to an old database the config still pointed at (since deleted).
the drill wrote down 9 gaps. the big one was that the tunnel credentials and the VPN key weren't in the config archive, so the rebuilt box could serve nothing until someone recreated them by hand. that was fixed the same night, and the realistic time to serving traffic is now about 10 to 12 minutes. the gap that mattered most to the client was the other one: the restore came back 2,194 customer filters short, because the best postgres copy was still a nightly dump.