3.3 KiB

title, description, ha_category, ha_release, ha_quality_scale, ha_domain, ha_codeowners, ha_iot_class, ha_integration_type, related
title description ha_category ha_release ha_quality_scale ha_domain ha_codeowners ha_iot_class ha_integration_type related
Backup Allow creating backups of container and core installations.
Other
2022.4 internal backup
@home-assistant/core
Calculated system
docs title
/installation/#advanced-installation-methods Home Assistant installation methods
docs title
/getting-started/onboarding/ Recover from backup during onboarding
docs title
/docs/configuration/ Configuration file
docs title
/common-tasks/os/#restoring-a-backup Home Assistant Operating System- Restoring a backup

The Backup {% term integration %} is used for {% term "Home Assistant Core" %} and {% term "Home Assistant Container" %} installations to create and download backups. This backup file can be used if you migrate to {% term "Home Assistant Operating System" %}.

Note: If you use {% term "Home Assistant Operating System" %} or {% term "Home Assistant Supervised" %} installation, this page is not for you. Instead, refer to the documentation on using the built-in back up.

Actions

The Backup integration exposes an action that can be used to automate the backup process.

Action {% my developer_call_service service="backup.create" %}

The {% my developer_call_service service="backup.create" %} action can be used to create a backup for your Home Assistant instance.

The action has no additional options or parameters.

Example action:

action: backup.create

Example: Backing up every night at 3:00 AM

This is a YAML example for an automation that initiate a backup every night at 3 AM:

automation:
  - alias: "Backup Home Assistant every night at 3 AM"
    triggers:
      - trigger: time
        at: "03:00:00"
    actions:
      - alias: "Create backup now"
        action: backup.create

Restoring a backup

Backups created via the Backup integration are in a subdirectory backups, located in your configuration directory. The {% term "Home Assistant Container" %} installation typically mounts this directory via docker-compose.yml or docker run to a directory of your choice.

The steps on recovering from a backup depend on the installation type and use case. Follow one of these steps:

  1. If you use {% term "Home Assistant Operating System" %} or {% term "Home Assistant Supervised" %}:

  2. If you use a {% term "Home Assistant Core" %} or {% term "Home Assistant Container" %} installation:

    • A Home Assistant backup is just a tar file of the configuration directory, plus some metadata.

    • To manually restore a backup, use the following command:

         tar -xOf <backup_tar_file> "./homeassistant.tar.gz" | tar --strip-components=1 -zxf - -C <restore_directory>
      
  3. If you migrate from a {% term "Home Assistant Core" %} or {% term "Home Assistant Container" %} installation to {% term "Home Assistant Operating System" %}:

    • You can use these backup files during onboarding to recover your installation from backup.