Skip to main content
Community Scripts logo
Skip to Content
Tools & Add-onsPVE Tools

container-restore-from-backup

Restore a Home Assistant backup archive into the Docker volume of a Home Assistant Container LXC.

container-restore-from-backup.sh unpacks a Home Assistant backup into the configuration volume of the Docker-based Home Assistant container. It is not listed on the website.

Despite its location in tools/pve/, it runs inside the Home Assistant LXC, not on the host. If pveversion exists it prints "Can't Run from the Proxmox Shell" and exits.

Source: tools/pve/container-restore-from-backup.sh.

Run

In the console of the Home Assistant Container LXC, as root:

bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/pve/container-restore-from-backup.sh)"

Requirements

  • A Docker container named homeassistant.
  • Its configuration in the Docker volume hass_config, that is /var/lib/docker/volumes/hass_config/_data.
  • At least one backup file in /var/lib/docker/volumes/hass_config/_data/backups/. Without one the script exits with 235 ("No backups found!").

Prompts

PromptInputEffect
This will restore Home Assistant Container from a backup. Proceed(y/n)?y / nn exits.
Please enter your choice:Number of a file in the backups directoryThe archive to restore.

What it does

  1. Creates /var/lib/docker/volumes/hass_config/_data/restore if it does not exist.
  2. docker stop homeassistant
  3. Extracts the chosen archive into the restore directory, then extracts the homeassistant.tar.gz it contains.
  4. Installs rsync with apt-get if it is missing.
  5. rsync -a copies restore/data/ over /var/lib/docker/volumes/hass_config/_data.
  6. Empties the restore directory.
  7. docker start homeassistant

Environment variables

VariableDefaultPurpose
COMMUNITY_SCRIPTS_CORE_URLhttps://raw.githubusercontent.com/community-scripts/core/mainBase URL the script loads api/api.func from.

Limits

  • Existing configuration files are overwritten by the ones from the backup. Files that are not in the backup stay. There is no undo; take a snapshot of the LXC first.
  • The archive must contain an unencrypted homeassistant.tar.gz. A password-protected backup cannot be unpacked this way.
  • Only the Home Assistant configuration is restored, not add-on or other archives inside the backup.
  • File names with spaces in the backups directory break the selection list.