↓ Skip to main content

3-2-1 Backups on a Laptop, End to End: What Each Copy Survives

2523 words·12 mins· loading · loading ·
Table of Contents
Project Aether – Building a Homelab - This article is part of a series.
Part 26: This Article

The series has told Aether’s backup story in pieces. Part 5 covered five ways the backups reported success while failing. Part 18 covered the drills that proved a restore works. Part 12 covered the night the power cut outlasted the inverter. None of them shows the whole design in one place.

This post does. It covers three kinds of data, three copies of each, two physical media and one offsite copy that root on the homelab can’t delete. It also covers the schedule, and a table of what each copy survives. Most choices here look odd until you see the failure they prevent, so each one comes with its reason.


The problem: three kinds of data, one laptop
#

Aether has three kinds of data that matter, and each one is lost in a different way:

Data Where it lives Why Git can’t rebuild it
Cluster state etcd, embedded in K3s on the only control-plane node Argo CD rebuilds every manifest, but not the state the cluster built up: Secrets, issued certificates, object history
App data on the cluster One PostgreSQL 16, a Redis, files on NFS, Paperless documents, CouchDB for Obsidian sync Notes, documents and bookmarks exist nowhere else
The cloud host’s data Docker volumes and databases on the Oracle Cloud VM The apps that haven’t moved to the cluster

Two smaller things need keeping too: the observer’s own data, and Terraform’s state. They’re in the bucket table below.

The constraints made it harder:

  • One physical machine. The laptop has an SSD, which holds every VM disk, and one HDD. A copy on the SSD next to the data it protects is not a second copy.
  • The ZFS pool is a single disk. No mirror. ZFS’s copies=2 can repair a bad sector, but it doesn’t survive losing the disk.
  • No inbound connections to the homelab. Cloud automation can’t reach in to pull backups. Every offsite transfer has to start from the homelab and go out (ADR-013).
  • Ransomware thinking. If an attacker gets root on the hypervisor, they must not be able to destroy the one copy that survives losing the homelab.
  • The budget. Backup storage is the one place the ₹0 budget bends, and only a little. Backblaze B2’s free 10 GB was the starting point.

The chain, night by night
#

Every job runs on one clock (IST), and the hypervisor’s three stages share one lock, so nothing overlaps. That rule came from an incident, covered below.

Time What happens Where it lands
01:15 Paperless exports every document, then checks each one against the checksum it recorded at upload NFS on the ZFS HDD
01:30 Every app database is dumped, read back, and its row counts recorded NFS on the ZFS HDD
01:45 CouchDB exports every database NFS on the ZFS HDD
02:00 K3s takes a compressed etcd snapshot (14 kept locally) The control-plane VM (SSD)
02:30 The hypervisor pulls the snapshot ZFS HDD
03:00 The snapshot goes into a local encrypted restic repository (14 daily, 4 weekly, 6 monthly) ZFS HDD
03:30 The newest snapshot is encrypted with age and uploaded as its own object B2, Object-Locked
04:00 The app dataset is snapshotted, then streamed as tar, zstd and age B2, Object-Locked
Nightly The cloud host backs up with restic to its own cloud’s object storage, then sends an offsite copy OCI object storage, then B2

App files also get hourly and daily ZFS snapshots, which cover the everyday mistake: a file deleted at 14:00 comes back from the 13:00 snapshot without touching any backup.

The backup chain: etcd snapshots and app data flow to the hypervisor’s ZFS pool, then to an Object-Locked offsite bucket, with a heartbeat at every stage

Every stage sends a heartbeat only when it succeeds. If a stage fails, the silence raises the alert.


Three copies, two media, one offsite
#

Copy Medium Holds
The live data SSD (inside the VMs) Everything, as it is now
The local copies The ZFS pool on the HDD etcd snapshots, the restic repository, dumps, exports, app files and their snapshots
The offsite copy Backblaze B2, Object-Locked Encrypted etcd snapshots and app-data snapshots for the last 30 nights; the cloud host’s copies in their own bucket

What turns three copies into protection is that each one fails for different reasons. Here’s what each failure costs:

What fails What saves it How much is lost
A file deleted or overwritten by mistake An hourly ZFS snapshot Up to an hour
A worker VM, with PostgreSQL on its disk Last night’s dump, restored Up to a day
The SSD (every VM disk) The HDD copies Up to a day
The HDD The live data is still on the SSD; B2 has the history Nothing, if the SSD survives
The whole laptop: fire, theft, both disks B2 Up to a day
An attacker with root on the hypervisor B2: they can’t delete a locked version, and can’t read what they could steal Nothing already uploaded
The cloud host’s whole Oracle account Its offsite copy in B2 Up to a day
Losing the age key that decrypts it all A second copy, recoverable through SOPS and Cloud KMS Nothing (scenario 04)

Every recovery point in that table is a day or less. The one exception is ZFS snapshots, which make the most common mistake an hour or less.


Every bucket and how long it keeps things
#

Six buckets hold Aether’s backups and state, across three providers. Each has its own rules, and each rule is in Terraform:

Bucket Holds Kept for What protects it
B2, locked (homelab) One age-encrypted object a night: the etcd snapshot, then the app-data snapshot The last 30 nights Each version locked for 30 days in governance mode, hidden when its lock ends and deleted a day later. The upload key can’t delete
B2, locked (cloud host) The cloud host’s nightly offsite copy The last 3 nights Its own bucket since INC-2026-018, with a 3-day lock and the same hide-then-delete rule
B2, restic copy (transitional) The older restic copy of the etcd repository restic’s own policy Hidden versions deleted after a day. Retired once a cold restore from the locked bucket passes
Oracle Cloud object storage The cloud host’s restic repository 7 daily and 4 weekly snapshots restic’s forget policy. It sits in the same cloud as the host, which is why the B2 copy exists
Google Cloud Storage (observer) Uptime Kuma’s data: every monitor and the push tokens other hosts report with 30 days The VM’s identity can only create objects: no reading, listing, overwriting or deleting. A lifecycle rule deletes copies after 30 days. Public access is blocked
Google Cloud Storage (Terraform state) State for every cloud Terraform root The current version plus 5 older ones; deleted objects recoverable for 7 days Versioning, soft delete and blocked public access

The observer’s data looks small but carries a lot. Losing it means recreating every monitor, and handing every host a new push token. The rebuild drill in part 19 restored it from this bucket, and the identity that writes it can’t read it back (part 16).

The state bucket is what every other recovery depends on. Without it, Terraform can’t manage anything it built. Versioning and soft delete cover a bad apply or an accidental delete, and the bucket is the only resource in its own bootstrap root, so even losing that root’s state is recoverable with a terraform import (ADR-011).

One pattern runs through the whole table: whoever writes a backup can’t destroy it. Upload-only keys, create-only identities, locks and soft delete all give the same guarantee, through different features.


The choices that look odd
#

Why the offsite copy isn’t a mirror
#

The easy way to copy a backup offsite is to mirror the bucket with rclone sync. A mirror copies mistakes as faithfully as data: an accidental purge, or a corrupted repository, reaches the offsite copy the same night. Aether’s first offsite stage used restic copy, which copies snapshots from one repository to another without copying the damage. The immutable copy that replaced it goes further, and mirrors nothing at all (ADR-018).

Why the locked copy isn’t a restic repository
#

Object Lock in B2 protects each object version for a fixed time from its upload. That sounds like exactly what a backup needs, until you look at how restic writes. Its config, its keys/ and most of its data packs are written once and then only referred to. Thirty days after upload, those objects are unlocked, and the homelab’s key could delete them. Lose keys/ and the whole repository is unreadable.

So the locked copy is different: each night is one self-contained object, the snapshot encrypted with age. Every object stands alone, so a lock on each object protects each night completely. The bucket keeps the last 30 nights, each locked for 30 days.

Why the homelab can upload but can’t delete, or even read
#

The hypervisor’s key can list and upload, and nothing else. B2 refuses its deletes, with or without the governance bypass flag; I tested that against a locked test object before trusting it. The hypervisor also holds only the public half of the age key, so it can’t decrypt what it uploads. Restores use a different, read-only key and a private key that never lives on the homelab.

An attacker with root on the hypervisor can still stop new backups. That’s what the heartbeats are for: a missed night pages me the next morning, long before the 30-day window runs out.

Why app data is copied in full every night
#

Restic would deduplicate, but at this size a nightly full copy is smaller than restic’s own index. A full copy is also one object per night, which fits the lock model above. A guard refuses to run above 20 GB. That’s the point to move to incremental uploads, and the guard makes it a page rather than a surprise bill (ADR-022).

Why backups leave from the hypervisor, not the cluster
#

Pushing from inside Kubernetes would need a B2 key inside the cluster and a new network grant. The hypervisor already has the upload-only key, the heartbeat path and the outbound connection. One proven chain is easier to trust than two.

Secrets in the snapshots
#

Until 10 November, every etcd snapshot held every Kubernetes Secret in plain text. That included the age key that decrypts the repository, so a stolen snapshot was a stolen key. Secrets are now encrypted at rest (aescbc). After rotating the key and compacting etcd, a search of a fresh snapshot for the old key found nothing. A cold restore with only the escrowed K3s token and a snapshot recovered the Secrets, so the restore path didn’t need a second key to escrow.


How I know it works
#

  • Heartbeats on success only. Each stage reports to Uptime Kuma on the observer in Google Cloud, and only when it succeeds. The app-data heartbeat needs every marker (the dumps, the Paperless export and the CouchDB export) to be under 26 hours old. One stale marker withholds it.
  • Drills, timed. The cluster restored from the offsite copy with its API ready 54 seconds after the reset. Four app databases, 69,840 rows, restored and compared with their dump-time counts in 29 seconds. A Paperless document went through export, checksum and import into a throwaway instance, and came back with matching pages, checksum and OCR text (part 18).
  • Lock tests. Deleting a locked object was refused with the upload key, with and without the bypass flag. The read-only key couldn’t upload. A restore with the read-only key gave a snapshot byte-identical to the original.

What broke on the way
#

Four incidents shaped this design. Each one has a public review.

  1. The second copy was on the first disk. The jobs wrote to a path that looked like the ZFS pool but was a plain folder on the SSD. The pool held 1.48 MiB. Each stage now has its own ZFS dataset, and the jobs refuse to run if it isn’t mounted (INC-2026-007).
  2. Two clocks. The hypervisor’s timers ran on UTC while K3s snapshotted on IST, which put six hours between stages that should have been 30 minutes apart. Now there’s one clock and one lock (INC-2026-008).
  3. The free tier was part of the recovery plan, and nobody had noticed. The cloud host’s first offsite upload sent the same 1.9 GiB file five times. The lock made every copy undeletable, and the account hit its 10 GB cap, which blocked every upload, including the homelab’s that night. Then, while proving the copy could be restored, the download used up the free daily download allowance, which would have blocked a real restore the same way. Both caps were raised, the upload now makes one attempt, and the cloud host’s copy has its own bucket with a 3-day lock (INC-2026-018).
  4. Tested on the host, run in a container. The cloud host’s offsite step worked when I ran it by hand. The nightly run happens in a small container that didn’t have rclone, zstd or age, so every night it failed with “command not found”. The local backup and its heartbeat stayed green, and only the offsite heartbeat went quiet, which is exactly why it exists (INC-2026-020).

What I learned
#

  • Count failure domains, not copies. Two copies on one SSD are one copy. The table of what each copy survives is the real design document.
  • Immutability has to match how the backup tool writes. Object Lock on a restic repository looks safe and isn’t. Self-contained objects make a lock mean what it says.
  • Quotas are part of the restore path. A storage cap can stop tonight’s backup, and a download cap can stop a restore. Check both before you need them.
  • Test where the job runs, not where you are. A script that works in my shell proved nothing about the container that runs it at 4 AM.

Architecture takeaways
#

A backup’s job is to fail independently
#

3-2-1 is a rule about independence: three copies so that two can be lost, two media so that one kind of failure can’t take both, one offsite so that one place can’t take all three. Every row in the table above is a failure that takes out some copies and not others. A design that can’t fill in that table hasn’t met 3-2-1, however many copies it makes.

The writer shouldn’t be able to destroy what it wrote
#

The machine that makes backups is the machine most likely to be compromised, so its credentials should be append-only. Upload-only keys, governance-mode locks and a public-key-only encryptor mean the homelab can add to the offsite copy, but can’t remove from it or read it. Restore gets separate, read-only credentials, kept somewhere else.

Report success, and let silence be the alarm
#

A backup job can’t reliably report its own failure. It may crash before it can, or it may never start. So each stage reports success to a watcher in a different cloud, and the watcher alerts when a report doesn’t arrive. That turns every failure mode, including the ones nobody thought of, into the same signal.


This continues from part 25, Day 2 Before Day 2. The whole series is on the series page.

Project Aether – Building a Homelab - This article is part of a series.
Part 26: This Article