Home Assistant Backup: How to Protect Your Smart Home Setup

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.

Check Your Setup Starter Kit Guide

Why Home Assistant Backups Matter

The average Home Assistant setup takes 20 to 40 hours to configure. Without a backup, one hardware failure means starting from zero.

Common Disasters

  • SD card corruption (the #1 killer)
  • Bad update bricks your install
  • Power surge fries the hardware
  • Accidentally deleting a config file
  • SSD or eMMC failure

With a Backup

  • Full restore in under 30 minutes
  • Move to new hardware instantly
  • Roll back bad updates
  • Test changes fearlessly
  • Sleep well at night

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.

What Does a Backup Include?

Home Assistant gives you two options: full backups (everything) or partial backups (you pick what to include).

Full Backup Includes:

📁 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.

Built-in Backup (Home Assistant OS)

If you're running Home Assistant OS (the recommended install method), backups are built right in. No add-ons needed for the basics.

1

Open Backup Settings

Go to Settings → System → Backups. This is where all your backups live and where you can create new ones manually.

2

Create a Manual Backup

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.

3

Download It

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.

Automated Backup Schedule

Manual backups are fine for one-offs, but you want something that runs on its own. Here are three ways to automate it.

RECOMMENDED

Method 1: Built-in Backup Schedule (2024.8+)

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.

Method 2: Google Drive Backup Add-on

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:

  • Automatic daily backups with configurable retention
  • Uploads to Google Drive (15 GB free)
  • Password protection for encrypted backups
  • Generational backup scheme (keep 3 daily, 4 weekly, 12 monthly)
  • Sends notifications if a backup fails
  • Web UI for manual backup and restore

Method 3: DIY with an Automation

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.

Offsite Backup Storage

A backup on the same machine that fails isn't a backup. Here's where to send copies for real protection.

📁

Google Drive

15 GB free. Best supported via the Google Drive Backup add-on. The most popular choice by far.

BEST
💧

Dropbox

2 GB free. Works with the Dropbox Sync add-on. Good if you already use Dropbox for other things.

🖥️

NAS (Synology, QNAP, TrueNAS)

Use the Samba Backup add-on to push backups to a network share on your NAS. Fast, local, and no cloud dependency.

🔑

Remote Server via SSH/SCP

Use rsync or scp to push backups to any remote Linux machine. Requires the SSH add-on and some comfort with the command line.

🪣

S3 / Backblaze B2

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.

Backing Up Home Assistant Docker

Running Home Assistant Container (Docker)? You don't get the built-in backup UI, but the process is straightforward.

What to Back Up

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.

Simple Backup Script

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.

How to Restore a Backup

Disaster struck? Here's how to get back up and running.

Restoring on Home Assistant OS

1

Fresh install: Flash Home Assistant OS to your new SD card, SSD, or hardware. Boot it up and wait for the initial setup screen.

2

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.

3

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.

4

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).

Restoring Docker

# 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.

Backup Best Practices

Follow these rules and you'll never lose your smart home setup.

1. Back Up Before Every Update

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.

2. Automate It

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.

3. Test Your Restores

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.

4. Encrypt Sensitive Backups

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.

5. Use Generational Retention

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.

6. Move Off SD Cards

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.

Backup Methods Compared

MethodSetup DifficultyAutomatedOffsiteWorks With
Built-in SchedulerEasyHA OS only
Google Drive Add-onEasyHA OS
Samba Backup (NAS)Medium⚠️ LocalHA OS
HA AutomationMediumAll HA installs
Docker Script + CronAdvanced✅ (with rsync)Docker only

Not Sure Where Your Smart Home Stands?

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.

Get Your Free Scan Docker Setup Guide

Frequently Asked Questions

How often should I back up Home Assistant?

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.

Can I restore a backup to different hardware?

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.

My SD card died. Can I recover without a backup?

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.

How big are Home Assistant backups?

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.

How do I back up Home Assistant Docker?

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.

Should I encrypt my backups?

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.