When you run one Raspberry Pi, cloning its SD card with dd is fine. When you run ten—across a 16×16 Unicorn HAT HD display, a 3.2-inch SPI touchscreen kiosk, a ClusterHAT with four Pi Zeros, a NUT UPS monitor with a USB webcam, a Sense HAT node, and a Google AIY Voice Kit—maintaining 32 GB .img files for every node is slow, wasteful, and almost always out of date by the time an SD card actually dies.
Instead, I built a configuration-as-restore pipeline: flash any stock Raspbian image onto a fresh SD card, boot it, and run one command to bring the node back identically—including its hostname, hardware overlays, custom daemons, and even its Tailscale IP and node identity.
Why Config Archives Beat Full SD Images
A stock Raspbian OS image is already reproducible. What makes each Pi unique is tiny:
/boot/config.txt&/etc/modules: SPI, I2C,rpi-sense,googlevoicehat-soundcard, and TFT overlays.- Networking & DNS:
/etc/hostname,/etc/hosts,/etc/dhcpcd.conf,/etc/resolv.conf.head, and Wi-Fi config. - Custom Systemd Units & Scripts:
/etc/systemd/system/*.service,/usr/local/bin/*, and/home/<user>/*.py. - Service State:
/etc/nut/*,/etc/weavescope/auth.pass, and/var/lib/tailscale/tailscaled.state. - Metadata (
meta.json):uname -marchitecture,apt-mark showmanualpackage list, and enabled custom units.
By deduplicating the 55 MB weavescope probe binaries by architecture (armv6l and armv7l) into a shared _shared/ directory under a thread lock, each Pi’s entire config.tar.gz shrinks to just 14.7 KB – 140.2 KB. All 10 Pis combined take less than 300 KB of unique config per snapshot.
Always Up to Date: Nightly Fleet Snapshots
A systemd --user timer (rpi-fleet-backup.timer) runs rpi_fleet_backup.py backup every night at 03:45 (Persistent=true). It connects to all 10 Pis in parallel—trying each node’s Tailscale IP first and falling back to its LAN IP—streams a fresh config.tar.gz over SSH, updates meta.json, and locks down permissions (0600) since tailscaled.state and service credentials live inside.
Whenever I tweak a kiosk script on rpi-4 or add a new service on rpi-rack, that change is automatically captured before morning.
One-Command Bare-Metal Recovery
When an SD card fails, recovery takes four steps:
- Flash a standard Raspbian image onto a replacement SD card (with SSH enabled and your public key).
- Boot the Pi and note its temporary DHCP IP.
- Run the restore command from the workstation:
python3 rpi_fleet_backup.py restore rpi-4 <new-pi-ip>
- Reboot once (
sudo reboot) so/boot/config.txthardware overlays take effect.
Under the hood, restore sets the OS hostname, installs Tailscale, stops tailscaled, extracts config.tar.gz onto /, copies the matching weavescope_<arch> binary, reloads systemd, and runs systemctl enable --now for tailscaled and every custom unit recorded in meta.json. Because /var/lib/tailscale/tailscaled.state is restored before starting tailscaled, the node rejoins the tailnet with its original identity and IP—no manual re-authentication links required.
Cold-Storage Insurance on LTO-4 Tape
To protect against losing the workstation drive itself, I wired the Raspberry Pi backup directory and rpi-fleet-backup systemd units into my backup_to_tape.sh core and full profiles. Every weekly snapshot—and any on-demand run—streams the entire Obsidian vault, agent scripts, and all 10 Raspberry Pi config archives straight to an HP Ultrium LTO-4 tape drive (2.1 GiB compressed with SHA-256 verification).
Fast local recovery from disk, plus air-gapped cold storage on tape—without ever managing another 32 GB .img file.