Migrate issue to new location

Hi,
I need help with the migration of HA (container based) and I can’t quite figure out how to get it working without strange errors.

I create backups in HA that are stored locally. I understand that you only need to unzip this into the Config folder at the new destination, is this correct?

How it looks like:


There is no “import backup” functionality unfortunately (I guess that is not made available in the docker version), so I need to do this manually.

What I did so far:

I saved the backup file on a share which is mounted at the new location/VM and unpacked it there:

tar -xf /share/nas/homeassistant.tar -C /home/docker/test

this results in:
/home/docker/test/homeassistant/data

the data folder contains the complete config folder with all of the HA files…

Now I’m ready to copy it to the new HA folder:

sudo cp -r -a /home/docker/test/data/. /home/docker/homeassistant/data/

Is this the correct way to do this? how my docker compose looks like:

services:
  homeassistant:
    image: ghcr.io/home-assistant/home-assistant:2024.9
    ports:
      - 8123:8123
    volumes:
      - /home/docker/homeassistant/data:/config
      - /etc/localtime:/etc/localtime:ro
    environment:
      - TZ=Europe/Amsterdam
      - DISABLE_JEMALLOC=true
    restart: unless-stopped

but when I start HA, it goes to recovery mode and doesn’t actually load anything

Am I missing something? Are the commands correct or is there perhabs another way to load the backup at its new location?
Thanks!

Have hidden folders been copied as well?
Check the presence of the .storage folder in your restored config folder

Import backup doesn’t exist in any type of HA, it has to be done at onboarding.
Sorry, I misinformed you. :blush:
@ShadowFist pointed this out: ‘you absolutely can import a backup after onboarding (at least on HAOS). Hit the 3 dots in the Backups screen > Upload backup, then simply restore like any other backup’

1 Like

From what I can see your commands and folder structure should be correct. Can you share the error logs?

Pff after a LOT of hours I got it working finally:

I created a new backup first (on the old server), in the HA GUI
saved it on the new server:
/home/docker/test

I renamed the backup file to x.tar (just to simplify things)

Then I went to the new server with Shell:
cd /home/docker/test

and executed the unpack command:
tar xf x.tar

You will get another tar file, so another unpacking moment:
tar xf homeassistant.tar.gz

then this command to copy the files from the unpack location to the final destination:
sudo cp -a /home/docker/test/data/. /home/docker/homeassistant/data

Thanks all for thinking along!

Note that a one-liner is documented

1 Like