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

core-restore-from-backup

Restore a Home Assistant backup archive into /root/.homeassistant of a Home Assistant Core LXC.

core-restore-from-backup.sh unpacks a Home Assistant backup into the configuration directory of a Home Assistant Core installation. It is not listed on the website.

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

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

Run

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

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

Requirements

  • Home Assistant Core with its configuration in /root/.homeassistant and a service named homeassistant.
  • At least one backup file in /root/.homeassistant/backups/. Without one the script exits with 235 ("No backups found!").
  • sudo, which the script uses to stop and start the service.

Prompts

PromptInputEffect
This will restore Home Assistant Core 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 /root/.homeassistant/restore if it does not exist.
  2. sudo service homeassistant stop
  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 /root/.homeassistant.
  6. Empties the restore directory.
  7. sudo service homeassistant start

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.
  • Only the configuration directory is restored. The installed Home Assistant Core version is not changed.
  • File names with spaces in the backups directory break the selection list.