Three stylised servers in a row, labelled 3, 2, and 1. The first is a black live server with four disk bays, the second is an amber backup appliance on a shelf, the third is a smaller orange off-site node at a distance. A red clock above evokes time-bound retention.
[ Storage & Backup ]7 min read

The 3-2-1 Backup Rule: Surviving Disasters

Phase 2 · The Network Matrix

Redundancy keeps the lights on when a bulb breaks. A backup is a time machine that lets you undo a disaster. The two are not the same.

Proxmox Backup Serverzfs sendrestichealthchecks.io

After building the ZFS vault, I felt unreasonably safe. A drive could die and the pool would keep running. Two drives could die and I had RAIDZ-2 to cover it. I had convinced myself I had solved the data-loss problem. Then I typed rm -rf in the wrong directory, and ZFS, doing its job perfectly, replicated the destruction across every mirror in real time. The pool was intact. The files were gone.

That was the morning I learned the distinction professionals had been quietly making for decades. Redundancy keeps the lights on when a bulb breaks. A backup is a time machine that lets you undo a disaster, including disasters of your own making. The two are not the same. A mirrored drive array is not a backup. A RAIDZ pool is not a backup. Even snapshots on the same pool are not, strictly, a backup, because they live and die with the pool that hosts them. A backup is a copy that is genuinely separate: different drives, different machine, often a different location, and always a different failure mode.

The Analogy

If ZFS is an archivist team that never sleeps, a backup is a second archive in a different building. The first archive protects against a single drive giving up. The second archive protects against the first archive being destroyed by a fire, a flood, a ransomware event, or your own tired-Tuesday-evening mistake.

There is a rule photographers have passed around for twenty years that works just as well for infrastructure: three copies of the data, on two different kinds of media, with at least one copy off-site. Peter Krogh’s The DAM Book popularised it in 2009 as a response to the early digital-photography generation losing family archives to spinning-disk failure. It has held up because it generalises cleanly: three copies gives you margin against correlated failures, two media types protects against a class-of-drive bug or a firmware recall, off-site handles the building burning down.

At home, the rule translates directly: the live copy on the server, a second copy on a separate backup appliance in the house, and a third copy somewhere else (a friend’s house, a small rented box, encrypted cold storage).

The Tech Translated

The software that made this tractable for me is Proxmox Backup Server (PBS). It is a sibling project of Proxmox VE, runs on the same Debian base, and speaks fluently to every hypervisor and container host I already had. The two features that matter most for a homelab:

Deduplication. Backups of virtual machines are almost entirely redundant between snapshots; a five-hundred-gigabyte VM that changes slowly produces only a few gigabytes of new data per night. PBS chunks every backup, fingerprints each chunk with a cryptographic hash, and stores each unique chunk exactly once. Thirty daily backups of that VM occupy roughly five hundred gigabytes plus the changes, not fifteen terabytes. The ratio I observe in practice is between 8:1 and 14:1 depending on workload.

Cheap full backups. Because of deduplication, every backup is a “full” backup in the sense that you can restore from any single snapshot without needing the preceding ones. There is no chain of incrementals to worry about. Any backup you have is a complete starting point.

Here is the rough shape of the appliance I built:

ComponentChoiceWhy
Chassis4-bay fanless mini serverLow power, low noise, sits in a cupboard.
Drives4 × 4 TB NAS-rated SATABudget. Not the fastest, but backups are sequential.
TopologyZFS RAIDZ-28 TB usable, two-drive tolerance.
OSDebian 12 + Proxmox Backup ServerSame ecosystem as the hypervisor.
NetworkDedicated 2.5 Gbps link to the server rackFast enough to back up 500 GB in about 40 minutes.

Observed deduplication ratio after six months of daily backups from two hypervisors: 11.3:1. That means what would have been sixty terabytes of raw backup data occupies five and a half terabytes on the appliance. Eight months of nightly snapshots fit in the budget I had planned for three.

The Action

A retention policy that matches how you actually lose data

The most common mistake I see in homelab backups is treating “keep forever” as the default. Retention is a design decision. Mine follows the shape of the mistakes I actually make:

# On the Proxmox hypervisor: schedule backups to the PBS datastore.
# Run every night at 1:30am.
# Keep: last 7 dailies, 4 weeklies, 6 monthlies, 2 yearlies.

# /etc/pve/jobs.cfg (managed through the web UI in practice)
vzdump: daily-backup-job
    enabled 1
    schedule 01:30
    storage pbs-main
    mode snapshot
    fleecing 1
    prune-backups keep-daily=7,keep-weekly=4,keep-monthly=6,keep-yearly=2
    mailnotification failure

Seven dailies catch the mistake I make on Tuesday and notice on Thursday. Four weeklies catch the mistake I make on the first of the month and notice at the end of it. Six monthlies catch the slow drift you only spot six months later. Two yearlies are for regulatory or sentimental reasons. Anything older than that is almost never useful and often a liability.

What broke

The backups worked. Flawlessly. For six days.

On day seven I noticed the PBS dashboard still showing the last successful run as “six days ago”. The SSH key used by the backup job had been rotated as part of an unrelated hardening pass, and the backup job had been failing silently every night since. The failure was being logged, but the job was not configured to send an email on failure, and I had not set up a dead-man’s-switch monitor to alert me when a backup did not run.

Silent failure is the most dangerous failure mode in backup. A loud failure you fix on the same day. A silent failure compounds until you actually need the backup, at which point you find out it has not run in a month. The fix was three things, and I apply them to every backup system I build now:

  1. Configure the backup tool itself to email on every run, not only on failure. A nightly “successful” email is annoying for about a week and invaluable forever.
  2. Add an external dead-man’s-switch. I use a hosted healthchecks.io endpoint. The backup script hits a unique URL after every successful run; if the URL has not been hit in the configured window (say, twenty-six hours for a daily job), the service emails me.
  3. Test a restore quarterly. An unrestored backup is a hypothesis, not a fact.

A minimal healthchecks-integrated backup hook looks like this:

#!/bin/bash
# /usr/local/sbin/run-backup-with-heartbeat.sh
set -euo pipefail

HC_URL="https://hc-ping.com/abc123-your-unique-uuid"

# Announce start (optional but useful for runtime metrics).
curl -fsS -m 10 --retry 3 "${HC_URL}/start" > /dev/null

# Run the actual backup.
if proxmox-backup-client backup \
     pct.pxar:/etc \
     --repository backup@pbs@pbs.internal:datastore01; then
  curl -fsS -m 10 --retry 3 "${HC_URL}" > /dev/null
else
  curl -fsS -m 10 --retry 3 "${HC_URL}/fail" > /dev/null
  exit 1
fi

Twenty lines of shell. A failure that would have cost me a month of silent missing backups now costs me an email in the morning.

The fire drill

The backup I trust is the backup I have restored. Every quarter I pick a virtual machine at random, destroy it on the hypervisor, and restore it from PBS. The last drill took nine minutes end-to-end for a 180 GB machine: four minutes for the network transfer, three minutes for the boot and service start, two minutes to verify the application was serving requests again. I write the drill result in a short log file with the date and the duration. That log is the only evidence that the backup actually works, because every other piece of evidence is a hypothesis.

Off-site, without renting the cloud

The third copy goes off-site encrypted. I send an encrypted ZFS snapshot weekly to a two-drive mirror in a small form-factor box at a friend’s house, over a site-to-site VPN established in entry nine. The mechanism is one-line:

# Encrypt and stream a snapshot to a remote pool.
zfs send -R tank/critical@2024-09-15 | \
  gpg --encrypt --recipient offsite@sebastianbourges.com | \
  ssh offsite@friend.internal 'gpg --decrypt | zfs receive cold/critical'

The GPG step is there so that even if the remote pool is physically stolen, the data stays opaque. The recipient keeps a sealed USB stick with the public key. I keep the private key. We trade the privilege of off-site storage for each other. The arrangement is older than S3 and costs neither of us anything.

The relief you cannot photograph

Nothing about backups is exciting. The day they matter, the mood is not triumph; it is relief. I have had three occasions in the last year when a backup rescued work: one rm -rf mistake, one failed Postgres upgrade, one container image that pushed a corrupt configuration to a service I depend on. In each case the fix was ten minutes of “roll back to yesterday”, and the hour I would otherwise have spent on forensic recovery simply did not happen.

That non-event is the product you are paying for. You rarely get to photograph it.

Footnotes

  1. Krogh, P. (2009). The DAM Book: Digital Asset Management for Photographers. O’Reilly Media. The 3-2-1 rule appears in Chapter 6 on “Backup Strategy”. ↩

  2. Proxmox Backup Server is open source under AGPL-3.0. Documentation: pbs.proxmox.com. ↩

  3. healthchecks.io is a dead-man’s-switch monitoring service with a free tier for small personal use. Self-hosted alternative exists at github.com/healthchecks/healthchecks. ↩

Table of Contents