You spent hours setting up automations, dashboards, and integrations. One SD card failure or bad update can wipe all of it. Here's how to make sure that never happens, with automated backups that run themselves and a restore plan that actually works.
The average Home Assistant setup takes 20 to 40 hours to configure. Without a backup, one hardware failure means starting from zero.
SD card warning: If you're running Home Assistant on a Raspberry Pi with an SD card, backups aren't optional. SD cards have limited write cycles and will fail eventually. It's not a matter of "if" but "when." Move to an SSD if you can, but either way, back up regularly.
Home Assistant gives you two options: full backups (everything) or partial backups (you pick what to include).
📁 Configuration files (YAML)
⚙️ Automations, scripts, scenes
📊 Dashboards and Lovelace config
🗄️ Database (sensor history)
🧩 Installed add-ons + their data
🎨 Custom integrations (HACS)
🖼️ Themes and custom cards
🔐 Certificates and secrets
💡 Partial backups let you skip the database to save space. The database (recorder) can be huge (several GB) and is often not critical. Your automations, integrations, and config are what really matter. Skipping the database means smaller, faster backups.
If you're running Home Assistant OS (the recommended install method), backups are built right in. No add-ons needed for the basics.
Go to Settings → System → Backups. This is where all your backups live and where you can create new ones manually.
Click Create Backup in the top right. Choose full or partial. Give it a name that includes the date (like "2026-02-21 before update"). The backup is saved as a .tar file in the /backup directory.
Click the three dots on any backup and select Download. Save it to your computer, a USB drive, or upload it to cloud storage. A backup that only exists on the same machine isn't really a backup.
💡 Always back up before updating. This is the number one rule. Before hitting that update button, create a fresh backup. If the update breaks something, you can roll back in minutes instead of spending hours debugging.
Manual backups are fine for one-offs, but you want something that runs on its own. Here are three ways to automate it.
Since version 2024.8, Home Assistant has a built-in backup scheduler. Go to Settings → System → Backups → Automatic backups. Set your schedule (daily is a good default), how many backups to keep (7 is reasonable), and whether to include the database.
This is the easiest option. No YAML, no add-ons. The downside: backups stay on the same machine. Combine this with an offsite solution (see below) for a proper setup.
The Home Assistant Google Drive Backup add-on (by sabeechen) is the most popular backup solution in the community. It creates backups on a schedule and automatically uploads them to your Google Drive.
What makes it great:
Want full control? Create a Home Assistant automation that triggers a backup on a schedule. Here's a simple one that runs every night at 3 AM:
automation:
- alias: "Nightly Backup"
trigger:
- platform: time
at: "03:00:00"
action:
- service: backup.create
data:
name: "Auto {{ now().strftime('%Y-%m-%d') }}"Add a notification action to get alerted when it completes. Combine with the Samba or SSH add-on to copy backups to another machine automatically.
A backup on the same machine that fails isn't a backup. Here's where to send copies for real protection.
15 GB free. Best supported via the Google Drive Backup add-on. The most popular choice by far.
2 GB free. Works with the Dropbox Sync add-on. Good if you already use Dropbox for other things.
Use the Samba Backup add-on to push backups to a network share on your NAS. Fast, local, and no cloud dependency.
Use rsync or scp to push backups to any remote Linux machine. Requires the SSH add-on and some comfort with the command line.
For the technically inclined. Cheap object storage ($0.005/GB/month on B2). Use rclone in a script to upload backups automatically.
The 3-2-1 rule: Keep 3 copies of your data, on 2 different types of media, with 1 copy offsite. For Home Assistant, that means: local backup on the machine, a copy on your NAS or computer, and a cloud copy on Google Drive. Sounds like overkill until your hardware dies.
Running Home Assistant Container (Docker)? You don't get the built-in backup UI, but the process is straightforward.
Your entire Home Assistant config lives in the volume you mapped when creating the container. Typically that's something like /opt/homeassistant or ~/homeassistant. Back up that whole directory.
Also back up your docker-compose.yml file and any .env files. These define your container setup and are needed to recreate the environment.
Here's a basic script that stops the container, creates a timestamped tar archive, and restarts it:
#!/bin/bash BACKUP_DIR="/backups/homeassistant" CONFIG_DIR="/opt/homeassistant" DATE=$(date +%Y-%m-%d_%H%M) mkdir -p "$BACKUP_DIR" # Stop container for consistent backup docker compose stop homeassistant # Create compressed archive tar -czf "$BACKUP_DIR/ha-backup-$DATE.tar.gz" \ -C "$(dirname $CONFIG_DIR)" \ "$(basename $CONFIG_DIR)" # Restart docker compose start homeassistant # Keep only last 7 backups ls -t "$BACKUP_DIR"/ha-backup-*.tar.gz \ | tail -n +8 | xargs rm -f echo "Backup complete: ha-backup-$DATE.tar.gz"
Save this as backup-ha.sh, make it executable, and add it to cron: 0 3 * * * /path/to/backup-ha.sh for nightly 3 AM backups.
💡 Skip the database for speed. Add --exclude='$(basename $CONFIG_DIR)/home-assistant_v2.db' to the tar command to skip the recorder database. This can save several GB and dramatically speed up the backup. You can always recreate history data; you can't recreate your config.
Disaster struck? Here's how to get back up and running.
Fresh install: Flash Home Assistant OS to your new SD card, SSD, or hardware. Boot it up and wait for the initial setup screen.
On the welcome screen: Instead of creating a new setup, click the three dots in the top right and select Restore from backup. Upload your .tar backup file.
Wait: Home Assistant will restore everything: config, automations, add-ons, integrations, the lot. This can take 10 to 30 minutes depending on backup size. Don't unplug it.
Verify: Once it reboots, log in with your existing credentials. Check that your automations, integrations, and devices are all working. Some integrations may need re-authentication (like Google or Spotify).
# Stop the container docker compose stop homeassistant # Remove old config (or move it aside) mv /opt/homeassistant /opt/homeassistant.broken # Extract the backup tar -xzf /backups/homeassistant/ha-backup-2026-02-21.tar.gz \ -C /opt/ # Start it back up docker compose start homeassistant
That's it. Docker doesn't care about the underlying hardware. As long as you have Docker installed and your compose file ready, you can restore anywhere.
Follow these rules and you'll never lose your smart home setup.
This is non-negotiable. Before updating Home Assistant, add-ons, or HACS components, create a backup. Updates occasionally break things, and having a recent backup means you can roll back in minutes.
Manual backups are better than nothing, but you will forget. Set up automated daily backups with the built-in scheduler or an add-on. Then set up offsite copying so the backups leave the machine automatically.
A backup you've never tested might not work when you need it. Once every few months, try restoring a backup to a test environment (a spare Pi, a VM, or a Docker container). Five minutes of testing now saves hours of panic later.
Your Home Assistant backup contains API keys, passwords, and tokens. If you're uploading to cloud storage, enable encryption. The Google Drive Backup add-on supports password protection. For Docker, pipe your tar through gpg before uploading.
Don't keep 365 daily backups. Use a generational scheme: keep the last 7 daily backups, 4 weekly backups, and 3 monthly backups. This gives you recent backups for quick rollbacks and older ones for "when did this break?" investigations, without eating all your storage.
If you're on a Raspberry Pi with an SD card, consider migrating to an SSD. You can boot a Pi from USB with an SSD adapter for under $30. SD cards will fail. It's just a matter of time. An SSD lasts years longer and performs much better too.
| Method | Setup Difficulty | Automated | Offsite | Works With |
|---|---|---|---|---|
| Built-in Scheduler | Easy | ✅ | ❌ | HA OS only |
| Google Drive Add-on | Easy | ✅ | ✅ | HA OS |
| Samba Backup (NAS) | Medium | ✅ | ⚠️ Local | HA OS |
| HA Automation | Medium | ✅ | ❌ | All HA installs |
| Docker Script + Cron | Advanced | ✅ | ✅ (with rsync) | Docker only |
Our free scan checks your current setup and gives you a personalized migration report. Thinking about switching to Home Assistant or already running it? We'll help you figure out the next steps.
At minimum, once a week. If you make frequent changes to automations, dashboards, or integrations, daily is better. The good news: you can fully automate this. Set it and forget it.
Yes. Home Assistant backups are portable across hardware. You can back up from a Raspberry Pi and restore to a NUC, or move from an old Pi 3 to a Home Assistant Green. Just make sure you're running a compatible HA version on the new hardware first.
Unfortunately, if the SD card is truly dead and you have no backup, your configuration is gone. You'd need to reinstall from scratch and reconfigure everything manually. This is exactly why backups matter, especially on SD cards.
Without the database: typically 50 to 500 MB depending on how many add-ons and custom integrations you have. With the database: 1 to 10+ GB depending on how much history you keep. You can limit the recorder's retention period to keep the database smaller.
Docker installs don't have the built-in backup UI. Instead, back up your config directory with tar or rsync. Stop the container first for a consistent backup. We have a ready-to-use script in the Docker section above.
If you're storing backups in the cloud, yes. Your backups contain API keys, passwords, tokens, and other sensitive data. The Google Drive Backup add-on has built-in encryption. For manual backups, use GPG or a password-protected archive.