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

home-assistant-container-copy-data-home-assistant-core

Copy the Home Assistant configuration from a Home Assistant Container LXC to a Home Assistant Core LXC.

home-assistant-container-copy-data-home-assistant-core.sh copies data between two LXC containers on the same node: Home Assistant Container (Docker) to Home Assistant Core. It is not listed on the website.

Source: tools/copy-data/home-assistant-container-copy-data-home-assistant-core.sh.

Run

In the Proxmox VE host shell, as root. If pveversion is missing the script prints "Run from the Proxmox Shell" and exits.

bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/copy-data/home-assistant-container-copy-data-home-assistant-core.sh)"

What is copied

ContainerPath inside the container
Fromthe one you pick first/var/lib/docker/volumes/hass_config/_data
Tothe one you pick second/root/.homeassistant

Existing files in the target are kept; files with the same path are overwritten.

Prompts

PromptChoicesEffect
Use to copy all data from a Home Assistant Container LXC to a Home Assistant Core LXC. Proceed(y/n)?y / nn exits.
"Which HA Container LXC would you like to copy FROM?" (radio list of all containers)One containerThe source. The list is shown again until one is selected.
"Which HA Core LXC would you like to copy TO?" (radio list of all containers)One containerThe target.
"Are you sure you want to copy data between the following LXCs?"Yes / No, preselected NoNo aborts the script with an [ERROR] line; nothing has been changed at that point.

Both lists show every container of the node. The script does not check that the container you pick runs the expected application; it only checks that the paths exist.

Steps

  1. Stops the target container if running (pct stop).
  2. Mounts the root disks of both containers on the host with pct mount.
  3. Checks that the source path and the target path exist. If one is missing the script stops with "directories in '...' not found".
  4. The target directory is not emptied (the rm -rf lines in the script are commented out or absent).
  5. Copies with rsync and the options --archive --hard-links --sparse --xattrs --no-inc-recursive --info=progress2.
  6. On exit, also after an error, unmounts both containers with pct unmount and removes its temporary directory.

After the copy

The script does not start any container. Start the target yourself and check the application:

pct start <target id>

Limits

  • There is no undo and no backup of the target. Back up or snapshot the target container first.
  • The source and the target must be on the same node, and the application must already be installed in the target so that the target path exists.
  • rsync must be installed on the host; the script does not install it.
  • The script reads no environment variables and sends no telemetry.
  • The source path has no trailing slash. rsync therefore copies the directory itself, and the files arrive in /root/.homeassistant/_data/ of the target, not directly in /root/.homeassistant/. Move them up one level in the target container if Home Assistant Core should use them.