Cannot move /config between a folder and a docker volume

I have used HA for years and have a set of devices managed through integrations, including ZHA. Up to now it was running in a container that has /config pointing to a standard folder named /etc/docker/hass.

I am changing the architecture of all my docker containers tu use docker volumes instead of folder mounts. I moved about 20 of them without problems (including complicated volume mountings), I am now stuck with HA.

I manually created a new volume and copied /etc/docker/hass over there. I tried to copy both with the permissions preserved and without.

When starting my HA container, I get normal logs (so /config is parsed correctly) but all of my ZHA devices are unknown:

2024-03-24T13:00:45.470129000Z 2024-03-24 14:00:45.469 ERROR (MainThread) [homeassistant.components.automation] Automation with alias 'salon ⬤ sofa ⬤ single' failed to setup triggers and has been disabled: Unknown device 'c7edc3c221484bb7b955ee36f993f862'

The error message above in an example where the automation salon ⬤ sofa ⬤ single uses a Zigbee button which is paired to ZHA.

When going to my HA home page, it behaves as if it was not set up, welcoming me and asking to set up my home with an account, password etc. (I did not go further).

When I roll back to the previous HA setup (with /config mounted to the folder) I am back to normality.

My question: what happened? Why are devices unknown and a new setup started?

Notes:

  • I copied everything, including /config/.storage (and other dot files/folders)
  • I tried a cp -r * and a cp -pr * to try with and without permission preservation (this was never an issue in the ~20 other volumes from many other services)
  • my suspicion was with /config/.storage but it is there with the correct content

I ended up starting a linux container to which I mounted both the volume and the folder, and did a cp -r /data_from_folder/. /data_in_volume/.

This fixed everything.

Now that I look at my previous cp commands I am not si sure anymore that .storage was copied correctly. Anyway - the approach above works.