Overview
This Raspberry Pi (fairhavenRpi) runs Home Assistant and Mosquitto in Docker. Backups are performed by a host-level script that copies:
- critical Docker bind-mount payload directories (the real Home Assistant + Mosquitto data)
- key system configuration (systemd units, tailscale/docker hardening, etc.)
- package inventory lists (to rebuild the host if required)
This is not a full disk image. It is a practical “rebuild + restore data” backup.
Backup location (Seagate drive)
Backups are written to the Seagate drive mounted at:
/mnt/seagate_sync/syncthing_data/FairRoweSync/rpi_backups/fairhavenRpi/<DATESTAMP>/
Where:
<DATESTAMP> is created automatically as YYYYMMDD-HHMMSS (example: 20260222-193506).
The Seagate path is intended to be synced onward via an existing Seagate/Syncthing arrangement.
What is backed up
A) Critical payload (what must be in place to restore HA/MQTT)
These are the Docker bind-mounts used by the containers:
- Home Assistant container:
- host: /srv/homeassistant/
- container: /config
- Mosquitto container:
- host: /srv/mosquitto/config/ -> container /mosquitto/config
- host: /srv/mosquitto/data/ -> container /mosquitto/data
- host: /srv/mosquitto/log/ -> container /mosquitto/log
These are backed up into the timestamp folder as:
srv-homeassistant/ srv-mosquitto/
(Example confirmation files commonly present:)
- srv-homeassistant/configuration.yaml
- srv-homeassistant/secrets.yaml
- srv-mosquitto/config/mosquitto.conf
- srv-mosquitto/data/mosquitto.db (persistence DB)
B) Recovery hardening + boot config
These are backed up because they are important for “remote recoverability” after a bad reboot:
- /usr/local/sbin/ (custom scripts, eg healthcheck tooling)
- /boot/firmware/config.txt (or /boot/config.txt depending on layout)
- /var/lib/jf_ha_healthcheck/ (persistent state to avoid reboot loops)
These are stored as:
* usr-local-sbin/ * boot-firmware/ * var-lib/jf_ha_healthcheck/
C) Host configuration + user environment
These are “rebuild helpers”:
- /etc
- /etc/systemd/system
- /etc/samba
- /home/jimfalk
These are stored in the timestamp folder with “slash-to-dash” names, eg:
etc/ etc-systemd-system/ etc-samba/ home-jimfalk/
D) Package inventory (rebuild helper)
Two files are generated per backup:
- dpkg-selections.txt
- apt-manual.txt
These help recreate the host package set on a new Pi.
How backups are run (automation)
The backup job is triggered by root cron:
15 4 * * * /home/jimfalk/backup_fairhaven_config.sh >/var/log/backup_fairhaven_config.log 2>&1
So it runs daily at 04:15 (local time) and writes a log to:
/var/log/backup_fairhaven_config.log
You can also run it manually any time:
sudo /home/jimfalk/backup_fairhaven_config.sh
How the backup script works (important details)
The script writes into a new timestamp directory each run, eg:
DEST_ROOT="/mnt/seagate_sync/syncthing_data/FairRoweSync/rpi_backups/fairhavenRpi"
DEST_DIR="${DEST_ROOT}/${DATE_STAMP}"
It uses rsync in a snapshot-friendly way:
symlinks are preserved as symlinks (no -L), so /etc broken symlinks do not cause rsync failure
it is a timestamped snapshot, so it does not rely on --delete
Core rsync pattern (conceptual):
rsync -aHAX "${SRC}/" "${DEST_DIR}/${REL_NAME}/"
Plus explicit copies of the Docker payload:
rsync -aHAX /srv/homeassistant/ "${DEST_DIR}/srv-homeassistant/"
rsync -aHAX /srv/mosquitto/ "${DEST_DIR}/srv-mosquitto/"
Restoring Home Assistant after an RPi failure
Key idea
To restore HA + Mosquitto on a replacement Pi (or rebuilt SSD), we mainly need:
- /srv/homeassistant (HA config + state)
- /srv/mosquitto (broker config + persistence DB)
Then recreate the Docker containers pointing at those directories.
Step 1 — Pick the backup set to restore
On the new/rebuilt Pi (after mounting the Seagate backup drive), choose the latest timestamp folder, eg:
/mnt/seagate_sync/syncthing_data/FairRoweSync/rpi_backups/fairhavenRpi/20260222-193506
For clarity in commands:
BACKUPROOT="/mnt/seagate_sync/syncthing_data/FairRoweSync/rpi_backups/fairhavenRpi/<DATESTAMP>"
Step 2 — Recreate the target directories
sudo mkdir -p /srv/homeassistant
sudo mkdir -p /srv/mosquitto/{config,data,log}
Step 3 — Restore the Docker payload directories
This is the critical restore:
sudo rsync -aHAX "${BACKUPROOT}/srv-homeassistant/" /srv/homeassistant/
sudo rsync -aHAX "${BACKUPROOT}/srv-mosquitto/" /srv/mosquitto/
(If permissions look odd, fix owners after restore; Mosquitto commonly uses UID/GID 1883.)
Step 4 — Recreate Docker containers pointing at the restored bind mounts
The restore assumes we run containers with the same bind mounts we used before:
Home Assistant:
- -v /srv/homeassistant:/config
- -v /etc/localtime:/etc/localtime:ro
Mosquitto:
- -v /srv/mosquitto/config:/mosquitto/config
- -v /srv/mosquitto/data:/mosquitto/data
- -v /srv/mosquitto/log:/mosquitto/log
ports 1883 and 9001
If we already have a docker compose file or docker-run scripts, use them (best). If not, recreate containers in the same way they were originally created.
After creation, ensure restart policy is set:
docker update --restart unless-stopped homeassistant mosquitto
Step 5 — Start and verify
sudo systemctl enable --now docker docker ps
Check:
Home Assistant responds locally:
- :1883
Optional: confirm HA config files exist:
- /srv/homeassistant/configuration.yaml
- /srv/homeassistant/secrets.yaml
What this restore does / does not do
It does restore our HA configuration, integrations, history DB (whatever is in /srv/homeassistant), dashboards, etc.
It does restore Mosquitto configuration and retained/persistent data (via mosquitto.db).
It does not automatically rebuild the entire host OS exactly as it was (because this is not a full disk image).
However, the backup contains /etc, systemd units, /home/<user>, plus apt-manual.txt and dpkg-selections.txt to rebuild host functionality if needed.
Quick verification commands (post-restore)
findmnt / -o OPTIONS systemctl is-active docker docker ps ls -la /srv/homeassistant | sed -n '1,40p' ls -la /srv/mosquitto/data | sed -n '1,40p'
Notes / operational guidance
Keep an eye on Seagate free space; timestamped backups grow indefinitely unless you add retention.
The HA payload can be large (hundreds of MB) — that is normal.
Mosquitto persistence may be small (a few KB) if retained messages are minimal; presence of mosquitto.db is the key indicator persistence is active.
<< Remote Recovery Run Sheet | | AR1 Arduino Sketch - Structure and Function >> |Table of Contents>
