On this page
Two approaches depending on your HA install
- Home Assistant OS / Supervised:Use the built-in backup feature to create .tar files, then push those files offsite with restic from the host.
- Home Assistant Docker / Core:Back up the config directory directly with restic, plus a separate database dump if you use an external DB.
Option A: Back up the HA backup files (HA OS / Supervised)
HA OS stores backups in /backup/ on the host. On a Proxmox LXC or VM, SSH in and back up that directory.
#!/bin/bash
source /etc/restic/env
# HA stores backups here
restic backup /backup \
--tag homeassistant \
--exclude="*.tmp"Retention runs with your cleanup key from one trusted machine, never from the hosts you back up. See retention on ServerCrate vaults.
Option B: Back up the config directory directly (Docker / Core)
#!/bin/bash
source /etc/restic/env
# Stop HA for a clean config backup (optional but recommended)
# docker stop homeassistant
restic backup /opt/homeassistant/config \
--tag ha-config \
--exclude="*/home-assistant.log" \
--exclude="*/.storage/lovelace*" # optional: skip UI cache
# docker start homeassistantAutomate with systemd timer
Wire the script to a systemd timer for nightly backup. See the systemd timer setup guide for complete unit files. The key setting is After=network-online.target so the backup waits for network before starting.
Triggering a HA backup before the restic run
For a clean snapshot, trigger a HA backup via the API before running restic:
#!/bin/bash
HA_TOKEN="your-long-lived-access-token"
HA_URL="http://homeassistant.local:8123"
# Trigger backup
curl -s -X POST "$HA_URL/api/services/backup/create" \
-H "Authorization: Bearer $HA_TOKEN" \
-H "Content-Type: application/json"
# Wait for it to complete
sleep 60
# Now run restic
source /etc/restic/env
restic backup /backup --tag ha-autoWhy Home Assistant backups need to be offsite
Home Assistant usually runs on a Raspberry Pi, mini PC or x86 box, and its SD card or disk is a single point of failure. SD cards fail often under HA's constant writes; without an offsite copy, you rebuild every automation and integration from scratch.
The HA backup holds your configuration, integrations, Lovelace dashboards, scripts, automations, blueprints and optionally history, so a restore takes minutes instead of days of rebuilding.
Home Assistant backup retention
For offsite backup via restic, a sensible retention policy keeps the last 7 daily and 4 weekly backups. HA .tar files range from 100 MB to several GB depending on history, so 7 days fits within the ServerCrate Starter plan.
To keep backups small, turn off "Home Assistant" history in the backup settings and rely on the recorder database for recent history. A config-only backup is typically under 100 MB, and it is the part that matters most.
Verifying your Home Assistant restore works
Test your restore on a spare Pi or in a VM before you need it. In HA OS: boot to onboarding, select Restore Backup and point it at your .tar file.
Repeat it every few months; it takes under 30 minutes.
Home Assistant backup questions
restic restore latest --target /tmp/restore --tag homeassistant to restore the backup files, then use the HA UI to restore from the .tar file.