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
| Prompt | Input | Effect |
|---|---|---|
This will restore Home Assistant Container from a backup. Proceed(y/n)? | y / n | n exits. |
Please enter your choice: | Number of a file in the backups directory | The archive to restore. |
What it does
- Creates
/var/lib/docker/volumes/hass_config/_data/restoreif it does not exist. docker stop homeassistant- Extracts the chosen archive into the
restoredirectory, then extracts thehomeassistant.tar.gzit contains. - Installs
rsyncwithapt-getif it is missing. rsync -acopiesrestore/data/over/var/lib/docker/volumes/hass_config/_data.- Empties the
restoredirectory. docker start homeassistant
Environment variables
| Variable | Default | Purpose |
|---|---|---|
COMMUNITY_SCRIPTS_CORE_URL | https://raw.githubusercontent.com/community-scripts/core/main | Base 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
backupsdirectory break the selection list.