A snapshot is taken locally, then shipped to an object store off-site. The job never reads the files it copies — it copies a frozen snapshot of the whole filesystem, so nothing can change under it halfway through and it needs to know nothing about databases, mail spools or anything else that would otherwise need its own special case.
The shape of it
What actually happens, in order
- At 02:30 the filesystem is frozen into a snapshot. This takes under a second and nothing notices.
- The job copies from the SNAPSHOT, never from the live files. This is why a database being written to at 02:31 is still captured consistently, and why the job needs no special handling for any particular kind of file.
- Changed blocks only go over the wire. A normal night is a few hundred megabytes, not two terabytes.
- The off-site store keeps every nightly version for 30 days. There is no "the backup" — there are thirty of them.
- The snapshot is released. If the job died halfway, the snapshot is released anyway on the next run, which is the only cleanup there is.
- Nothing checks the job. Separately, each morning, a checker asks the off-site store how old its newest copy is and complains if it is more than 36 hours. That is the entire alerting story.
The checker deliberately does not watch the job, and that looks backwards until you have been bitten. A job that runs and does nothing satisfies every check that watches the job — that is precisely how eleven nights went missing here once, each one exiting cleanly. Watching the result means the alert fires whether the job crashed, lied, or was never started at all, and it needs to know nothing about how the job works.
The cost of that choice: the alert is up to 36 hours late. That is the trade, and it was made on purpose — a late alert that cannot be fooled beats an instant one that can.
If you are changing this
- The job and its schedule:
ansible/roles/backup/in the homelab repo. - The checker:
scripts/backup-freshness.sh, run from the morning heartbeat. - Do not make the checker read the job's status. It is the separation that makes it worth having; a checker that trusts the job is the job marking its own work.