Backups That Restore: Testing the Thing You Hope to Never Use
A backup you have never restored is a hope, not a backup. Our quarterly restore drill, the 3-2-1 rule applied to real VPS budgets, and the cron job that lies to you.

Every server we have ever inherited had backups. A cron job ran nightly, a tarball grew in a directory, and everyone slept well. Then the day came to restore one, and we learned the difference between having backups and having a backup.
The tarball was corrupt. Or the database dump was taken mid-write. Or the backup lived on the same disk as the data it was protecting, which is to say it was not a backup at all — it was a second copy of the same failure.
The 3-2-1 rule, translated to a VPS budget
Three copies, two different media, one offsite. On real infrastructure that means:
1. The live data on the server. 2. A local snapshot — fast to restore, protects against fat-fingered deletes. 3. An offsite copy — object storage in a different provider's region, protecting against the whole box (or provider) going away.
The local snapshot is optional convenience. The offsite copy is not optional. If your backup and your server share a failure domain, you have one copy with extra steps.
The cron job that lies
0 3 * * * pg_dump mydb > /backups/mydb.sqlThis job can fail every night for a year and nobody notices, because cron mails its errors to a mailbox nobody reads. The disk fills, the dump starts failing, the file is zero bytes — and the monitoring says nothing because there is no monitoring.
Two fixes, both mandatory. First, check exit codes and alert on failure:
0 3 * * * /usr/local/bin/backup.sh || curl -fsS -m 10 https://hc-ping.com/your-uuid/failSecond — and this is the one people skip — ping a healthcheck service on success, and let the service alert when the ping stops. Failure alerting misses the case where cron itself is dead. Absence alerting catches everything.
Dump databases consistently
A naive pg_dump or mysqldump on a busy database can produce a file that restores into a corrupted state. Use the flags that exist for this:
class="text-code-comment"># PostgreSQL — consistent snapshot, custom format, compressed
pg_dump -Fc -Z6 mydb > /backups/mydb-$(date +%F).dump
class="text-code-comment">
# MySQL/MariaDB — single transaction, no table locks on InnoDB
mysqldump --single-transaction --quick mydb | gzip > /backups/mydb-$(date +%F).sql.gz--single-transaction is the flag that separates a consistent dump from a coin flip. If your backup script does not have it, your backups are a lottery.
The restore drill
Backups are verified by restoring them, on a schedule, to a machine that is not production. Our quarterly drill, in full:
1. Spin up a fresh VPS — same OS, nothing else. 2. Pull the latest offsite backup. 3. Restore the database and files. 4. Boot the application and run the smoke tests. 5. Time the whole thing and write it down.
The first time you do this it will fail. The restore script assumes a directory that does not exist, the dump is in a format the fresh box cannot read, the credentials live in a file that was never backed up. Every one of those failures is a gift — you found it on a Tuesday afternoon instead of during an incident.
The time measurement matters as much as the success. "We can restore in 40 minutes" is a recovery objective. "We have backups" is a feeling.
Retention is a decision, not a default
Keep dailies for a week, weeklies for a month, monthlies for a year. Rotate them in the script, not in your head:
find /backups/daily -name class="text-code-string">'*.dump' -mtime +7 -deleteAnd once a year, ask whether the backup covers everything the business now depends on. The answer is usually no — something new got deployed in March and nobody added it to the script. Backups rot like everything else. The drill is what keeps them honest.
Paj Digital Labs
The engineering journal of Paj Digital Solutions — hosting, server infrastructure and web engineering, written by the people who run the servers.
Related reading

PostgreSQL Connection Budgets: Pooling Without Hiding the Bottleneck
More application workers can exhaust database connections long before CPU is full. Budget the whole fleet, understand pool modes and test session behaviour before adding a pooler.

Restore Drills for a Whole Website: Rebuild the Service, Not Just the Database
A database restore can succeed while the website remains unusable. Test files, configuration, identity, DNS and external dependencies in an isolated recovery environment.

TLS Certificate Renewal: Verify the Served Certificate, Not Just the Cron Job
A successful renewal command does not prove visitors see the new certificate. Trace issuance, reloads, proxy termination and external monitoring before an expiry becomes an outage.