Restore Docker Backup?

Hello,

I’ve been using HA in a Docker container on an old x86 desktop that has long served as my home server. I’d like to replace this server and have moved some of the smaller services to a Pi 4. I’d like to move the HA installation as is to the Pi as well. I figured the backup utility would be my friend here, and that it would create a platform-independent tar or something that could easily be restored, but… y’know, FOSS. I got the backup over to the new container, it shows in the “backups” menu, but there is no option to restore it.

I took to DuckDuckGo and found a few folks with similar issues on these very forums, and it seems the answer to “how do I do this” is “you don’t”, or at least not really. I was able to copy the config successfully, but this doesn’t seem to include all the HACS stuff, custom themes, dashboard configuration, etc. The new install seems to pick up on the old config, but it seems almost everything I actually use is some kind of third-party addon.

I also tried to create my own image of the existing container, copy that over, and fire it up on the Pi. Shockingly, x86 containers do not work on ARM processors. This seems like it would be the way to go if the target architecture were x86, so I may just wait until I replace the server and move it to the new host.

I set up my existing install over the course of several years, primarily with the powers of ADHD and inebriation, so recreating it is going to be very time-consuming. Even something that requires considerable Linux-fu would be preferable. My question is basically this: is there no way at all to just copy everything over, addons included? Maybe copying over more directories than /config?

My second question is: if no, why is there a backup button at all in the Docker version?

Many thanks to anyone with wisdom to share on this topic.

1 Like

Sadly only HAOS has a restore option, and the backup docs do call that out.

For everybody else you have to uncompress the backup to get the homeassistant.tar.gz file and then extract that wherever you need it.

Well, no add-ons here :wink: Any other software you installed you have to back up.

If you meant the “HACS stuff” then that’s not add-ons, that’s custom integrations and custom cards (etc) and included in the backup of HA.

To make it easier to migrate to HAOS.

Personally I prefer to use a proper backup solution (rclone, rsnapshot, kopia, duplicati, urbackup, etc).

2 Likes

‘HA container’ backup has worked well for me several times but, as @Tinkerer has explained, you have to restore manually (via SSH or a file manager).

The .tar expands to 2 files in a subdirectory of the same name as the .tar

  • backup.json
  • homeassistant.tar.gz

homeassistant.tar.gz expands to the full HA /config directory in a sub-directory called data

  • The backup excludes backups in the /config/backups directory
  • Remember there are invisible files and folders there (eg: /.storage)

Copy its entire contents to your correct /config location.

I’m only adding to @Tinkerer comments to assure you that it works.

4 Likes

Hi all, thanks for the replies. I finally got around to fixing this after getting the rest of my service VMs moved the new host.

Still not sure what was up with restoring the backup. I followed the docs as well as my poor little brain was able but never got everything working. Whatever I was doing did bring over some things, but I must have installed something not included in the backup, was doing it wrong, or some combination thereof.

For anyone who ends up here on Google in the future and wants a Bad Solution, I went with what is probably the worst possible one and converted the old host into a VM on the new one, preserving the HA and Docker configurations exactly as-is. Thankfully I had been good about not installing anything other than KVM and Docker on the old host, so after removing KVM and having already migrated the existing VMs I was left with a pretty small image.

Extremely inelegant, I realize, but it works. I also didn’t learn anything in this process, which is how I like it. :smiley:

In my case I am using HA container on k3s and to restore my backup I extracted the homeassistant.tar.gz in a different place and pushed all files to the right pvc place of my ha pod and left behind the databases home-assistant_v2.db and
home-assistant_v2.db-wal as no matter what I did replacing these db’s from backup I got an error and the bacup doesn’t restore and you end up landing on the onboarding screen to create your ha from scratch.

sorry - just seen this.

There are hidden files/folders in the backup (starting with . eg: .storage/...). Are you certain those were also copied back?

For what’s worth I use HA core on docker with a separate volume (bind) for the config folder. I back up my whole system using rear AND an rsync script to my Nas.
Have tested a bare metal restore and it works.
Only precaution I shut down mariadb (my recorder db, with 366 days of retention) before the backup and restart it afterwards.