Quiet Notes

Backing up a Raspberry Pi without losing an evening

October 12, 2026

My little Pi runs a handful of quiet jobs: it collects temperature readings, serves a shared folder, and keeps a few scripts I would hate to rewrite. For a long time its backup plan was "I should do something about that." Last month the memory card started throwing read errors, and that settled it.

What I wanted

Nothing clever. A copy of the files that matter, on a different disk, made automatically, and a way to check that the copy can really be used.

The setup

An external drive is mounted at /mnt/backup. One script copies the folders I care about and keeps seven daily snapshots using hard links, so unchanged files take no extra space:

#!/bin/sh
set -eu
dest=/mnt/backup/pi
today=$(date +%F)
rsync -a --delete --link-dest="$dest/latest" \
  /home/pi /etc /var/lib/shared "$dest/$today/"
ln -sfn "$dest/$today" "$dest/latest"
find "$dest" -maxdepth 1 -type d -mtime +7 -name '20*' -exec rm -rf {} +

One cron line runs it at three in the morning. That is the entire automation.

The part people skip

A backup you have never restored is a hope, not a backup. I copied a snapshot to a spare card, booted from it and checked that the shared folder and the scripts were all there. It took about forty minutes and found one missing path, which I added to the script.

What I would change

I would also keep a monthly copy somewhere that is not in the same room. For now, the card can fail whenever it likes.

← All notes