The newest copy of 4,361 customer records was thirty six days old
Three small businesses use a platform I run. Their appointment books are in it. So are their guest lists, their message history with those guests, their consent records and every payment they have taken through it. If one of those owners loses that database, they do not lose a website. They lose the answer to who their customers are.
I queried it this morning before writing this. It holds 4,361 customer records, 3,973 payments, 467 appointments, 1,393 messages, 202 consent records and 157 reviews, across three tenants.
Until Monday September 8 there was no scheduled backup of it.
What was actually on disk
I want to be precise, because "no backups" is usually an exaggeration and in this case it would be one.
There were copies. Eight of them, sitting in the database server's own home directory, with names like platform-pre-004 and platform-pre-customer-import. Every one is a manual snapshot I took by hand immediately before running a migration or an import, so that I could put it back if the migration went badly. They are dated between July 25 and August 2.
That is a perfectly good habit and it is not a backup. A pre-migration dump exists to protect the migration. It is taken because I am about to do something dangerous and I am thinking about it. Nothing takes one on a quiet Tuesday when nothing is happening, which is most days.
So on the evening of September 7, the newest copy of that database was dated August 2. Thirty six days old. And it was on the same disk as the database it was a copy of, which means it protects against my mistakes and against nothing else.
The detail that makes this worse rather than better: on the same machine there is an internal scheduling tool I built for my own business, and it has 28 dated nightly dumps sitting in a backup directory, produced by a job that has been running quietly for a month. The box already knew how to do this. I had set it up for the tool I use and not for the platform holding other people's customers.
old: eight hand taken pre migration dumps, newest thirty six days old, on the same disk as the database
new: a nightly dump verified at write time, a separate daily check that it is fresh and readable, and an email to me when either is notWhy the obvious alerting would not have helped
The systemd way to be told about a failed job is OnFailure=. Attach a handler and it runs when the job fails.
That sounds like the whole answer and it is not, because OnFailure= only fires when the unit runs and fails. It is completely silent for the failure mode that actually bites people:
- the timer gets disabled or masked and never re-enabled after a change
- the unit file gets edited into something that no longer starts
- somebody stops the timer during maintenance and forgets to start it
- the machine is off, or the clock moves, and the trigger is missed
In every one of those cases nothing fails, so nothing alerts, and the newest dump silently ages. That is the "broken for a month and looks fine" case, and it is not hypothetical here, because that is exactly the state I was already in. A monitor that watches for failure cannot see a job that never ran.
So the backup has two guards, not one. The nightly job has an OnFailure handler for the ordinary case. And a second unit on its own timer, two hours later, asks the only question that actually matters: is there a fresh, readable dump on disk right now. It does not share a fate with the job it watches. It complains if the newest dump is more than 36 hours old, or absurdly small, or fails verification.
It re-runs pg_restore -l against the newest dump on every pass. The nightly job already verifies at write time, but write time verification by definition cannot see a file that was fine when written and got truncated, corrupted or half deleted afterwards.
It also dumps and checks the roles, which is the classic omission. A data dump restored onto a fresh host fails on the first GRANT if the roles do not exist. The check asserts by name that the five roles the application actually needs are present in the newest roles file, and that the file carries its completion marker rather than being truncated.
There is no mail transfer agent on that machine, so the alert handler sends through the same email provider credential the application already uses, read at run time rather than copied into a config file, so the box keeps exactly one copy of that key. The alerts go to me alone. They deliberately do not go to the client facing digest list, because a backup failure is my operations problem and telling a business owner about it helps nobody.
I tested the alert path three times on September 8, including by deliberately breaking the backup unit so it exited non zero and watching the failure email arrive.
What this does not prove, in order of how much it bothers me
The offsite copy still does not exist. As I publish this, every copy of that database is on one machine. If that machine is lost, the nightly backups are lost with it, and the platform is back to nothing. The hook is written and inert, it prints offsite: DISABLED in its log on every single run so it never quietly looks solved, and the runbook for turning it on is written and sitting next to it. It costs five dollars a month. It is not done. That is the honest state of this a week later, and the part of the gap that actually protects against the disaster people imagine when they say the word backup is the part still open.
I have never restored it. pg_restore -l reads a dump's table of contents and tells you the file is structurally intact. It does not tell you the restore works, that the application starts against it, or that the data is complete. There has been no drill onto a fresh host. A backup you have not restored is a belief, not a capability, and right now that is what I have.
Nothing was lost. There was no incident. No data was corrupted, no disk failed, nobody asked me for a copy. This post has no cost attached to it, which makes it weaker than most of what I write here. I am publishing the gap, not the damage.
Thirty six days is what I can prove, not necessarily the whole truth. The journal on that machine only goes back to mid June, so I am reading the gap off the files on disk. It is possible there is some copy I do not know about. It is also possible the gap was longer before those pre-migration dumps started in July.
I cannot tell you whether the hosting provider's own snapshots were enabled. That is the single biggest hole in this account. Providers sell a weekly droplet level snapshot, and if it was on, the true exposure was days rather than thirty six of them, and much of the urgency above is retrospective drama. I could not establish it from the machine itself and I have not gone and checked the billing console. What I can prove is narrower and I will not stretch it: no process on that machine was producing a restorable database dump on any schedule.
The argument against all of this
Someone reasonable will say this is a 2 MB database for three small businesses and I have built a two unit, two timer, verified, self checking backup system with a runbook for an amount of data that fits in an email attachment. Provider snapshots plus a monthly manual dump would have been proportionate, and the hours here would have been better spent on something a customer can see.
That is a fair reading of the effort and I think it is wrong on one point. The size of the database has nothing to do with the cost of losing it. A guest list and two years of appointment history is the most valuable thing a small service business owns, and it is not reconstructible from anywhere. The 2 MB is why this is cheap to protect, not why it is unimportant.
The part of the criticism I do accept: I did this in the wrong order. I built the sophisticated local half, which guards against a failure mode I control, and left undone the five dollar offsite half, which guards against the failure mode I do not. Ranked by what they actually protect against, I did the second thing first.
What carries over to anyone running software for someone else
A monitor that only fires on failure is not coverage. Ask separately, from a different schedule, whether the thing you expect to exist actually exists right now. The interesting failures are silent.
Verify at rest, not just at write. A file that was good when you wrote it is not the same claim as a file that is good today.
And notice where you have already solved a problem for yourself and not for the people paying you. The nightly dumps for my own internal tool had been running fine for a month next to a client platform with nothing. That was not a technical failure. It was an ordering of attention, and it is the one I would most like other people to check for in their own setup.
I run small production platforms for service businesses at Autosterea. This is the unglamorous half of that, and it is the half that decides whether a bad week is survivable.
First published on ravikantdewangan.com.

