How to move or clone HA installation (+ no controls to restore a backup)

Using HA in Docker w/o Supervisor.
Need to move a HA installation from one PC to another.

What I did is:

  1. Created a backup in System → Backups:
    изображение

  2. Installed HA on the 2nd PC.

  3. Created a “backups” folder on the config folder on the 2nd PC.

  4. Created a backup on the 2nd PC - just to be sure that it is created on the expected folder.

  5. Copied the backup tar-file from the 1st PC to the 2nd.

  6. Now I want to restore the 1st backup on the 2nd PC.
    I do not see this backup in the list - the list contains only the small test backup mentioned in pt.4:

Both backup files are present in the “backups” folder:
изображение

But the small test backup has another ownership (or how it is called).
Probably it was changed during a copy procedure. On the source location it is “root root”:
изображение

Could it be a reason why this 1st backup is not visible in the list?


Another way I tried to use is:
Copy whole HA folder on the 2nd PC.
I made this from Windows, so it took these steps:

  • copy the HA folder to a shared folder on the 1st PC;
  • open a shared folder of the 1st PC in Windows Explorer (let’s call this folder “Transfer_1”);
  • open a shared folder of the 2st PC in Windows Explorer (let’s call this folder “Transfer_2”);
  • copy the HA folder from “Transfer_1” to “Transfer_2”;
  • copy the HA folder from a shared folder to the “home” folder on the 2nd PC.

During the copy procedure Windows was unable to move an “auth” file.
So the HA folder on the 2nd PC was w/o this “auth” file.
And after starting HA I got a login screen - and I could not login.

I deleted the “onboarding” file and restarted HA.
Then after starting HA I got a “create new user” screen - and I stuck on this screen, it was not closed after pressing the “register” button.

Update: later I managed to to copy whole HA folder to the 2nd host - see here.


Update:
These commands did not help:

sudo chown root:root d64e6de4.tar
sudo chmod -x d64e6de4.tar

The file is still not present in the list although it looks like similar to the small test backup file:
изображение

Make your life easy, replace the “Copied the backup tar-file from the 1st PC to the 2nd.” just by uploading the backup through the UI (that would be on your second picture the three-dot-menu in the upper right corner).

No permission or ownership hassle… :slight_smile:

It is not there:

Probably we are using different HA installations.

Since I changed ownership and it did not help - do not know what could be a reason.

Restarted HA and now I see this backup from the 1st PC:

I wonder why restarting HA is required to see a new backup in a list…

But - how am I supposed to restore a backup?
I do not see any controls for it…

I noticed that this docs have no info regarding restoring backups.
Why to add a “backup” feature w/o a possibility to restore???

During installation of the second instance, you are supposed to be offered the option to restore a backup. Didnt you get that?

btw, those backups are (can be) tied to the IP address of the original instance, or have other Add-on settings that need to be adapted to the new instance location. (dont forget the duckdns and related connective add-ons in that regard)
Its never a 1-1 copy for that matter

No. The only thing I saw was to create a user, select place, country etc.
Surely this is a good option - to use a backup on the first start.
There is some probability that I missed this option somehow.

But anyway, there must be a way to restore a backup even w/o reinstalling HA…

Associating to a fixed IP - mmm, do not think that it’s a good thing.

As for add-ons - why a user should repeat the whole setup of the old HA instance just to restore a backup? All settings - as well as a earlier installed addons - must be included in the setup.

click the backup and see:

select your choices and click Restore? (bottom left)

Cannot select it , it does not cause anything.
Same was on the 1st HA installation.

Also even the “native” small test backup (which was made on the same HA) is not selectable.

hmm, just checked that on the 2022.7.5 Backup menu which looks a bit different from yours:

this is HAOS though, maybe there’s difference there.

Probably yes. I am using HA in Docker.

Issue:

Here is how I managed to move my HA installation to another host:

1.Goto the 1st host (source host).

2.Stop HA container.

3.I need to copy the HA folder to another PC – but I did not manage to copy that “auth” file (as I wrote here). But we may create a tar-file for HA folder which then may be copied to another host:

a) Create a copy of HA folder (let it be “HA”) – but w/o DB files – to a “HA_2”.

b) Tar this folder:
sudo tar -cf HA_2.tar HA_2

c) Copy this “HA_2.tar” file to the 2nd host (I was using Windows Explorer and shared SAMBA folders in both Debian hosts).

d) Place this “HA_2.tar” file to the “home” folder. Untar this file:
sudo tar -xf HA_2.tar

Now you got the same HA folder on the 2nd host.

4.Copy DB files to the 2nd host, then create/start HA container.

So, I managed to clone/move HA installation w/o using a “HA backup” feature (which does not work in my case).

You could have untarred the backup file.

1 Like

In my last post I wrote about untarring, what do you mean?

The backup file consists of the folders that are used in your HA installation. If you un-tar it, you have just the folders from the “old” installation. You can use these to overwrite (or newly create) the folders in your new installation.

All the things you’re talking about are only in regard to the backup itself, but not for the tarred folders inside.

The way you described above will work, but it’s the most complicated I can imagine, sorry! I’m sure you wanted to get your data back fast, and so did what you could think of, but that doesn’t necessarily mean it’s the best approach. :slight_smile: We all have done that not only once in our installations, it is the way people react, when they run out of time and patience.

But all in all, the most important thing is, it works for you! :slight_smile: :+1:

Have a good day and enjoy your HA came back to life! :slight_smile:

Yes, that is what I finally did - tar the source folder, copy it on the 2nd hast, untar.

You are absolutely right.
I wanted to do - create a backup on the 1st host, copy backup to the 2nd host, restore a backup using “HA backup feature”. But I failed since could find a “restore” function.
So, the main question is - where is a “restore” feature in my installation?

Yes, thanks a lot for good words ))))


And probably I could use a combination (probably this is what was proposed here):

  • create a backup (using the “HA backup feature”) on the 1st host → get a tar-file;
  • copy the tar-file to the 2nd host;
  • untar (using “tar -x” command).

But I realized a strange thing:

  1. The backup file was about 600-800MB. My DB is 4.3GB - ok, let’s assume that it was packed nicely into these 600-800MB.
  2. When I decided to use that “my tar-copy-untar way” - initially I wanted to tar my whole HA folder including DB files. When I created a tar-file by myself - it was much bigger than 600-800MB. I even do not know how bigger - the “tarring operation” failed due to “no free space on HDD” reason! I had about 5-6GB of free space, and that was not enough!
  3. So, I decided to tar the HA folder w/o DB files - and then copy DB files after untarring (as I wrote here). Reason - I started worrying “what is inside a backup file if it is so small?”
1 Like

That is a good question. Unfortunately I don’t run HAcore, so I can’t have a look. :slight_smile: And in the demo of HA the settings are disabled. :slight_smile: Sorry. :slight_smile:

But as you said yesterday yourself, and I can only fully agree, for the sake of helping and giving support one would need to install it himself, and that is something I only do very, very rarely. :slight_smile: (was in another thread, something with a card, not in a communication with me) :slight_smile:

1 Like

Yes, about card-mod - actually, not a big deal for me - install a plugin, test it, uninstall. Only matter of time.
But testing ANOTHER installation of HA is a much bigger task.

1 Like

I think I got your point.
Answered here.

tar is an archiving format. It saves a whole file directory into one file, usually with a .tar extension. So to tar a directory is to save it in a .tar file, and to untar it is to go back the other way.

tar files are uncompressed so it is common to use gzip or another compression format to make them smaller. Such a file is usually given the extension .tar.gz or (if compressed by xzip) .tar.xz. You can restore or untar them too.

If you look at a home assistant backup, you’ll see it is a tar file containing one or more .tar.gz files. Each of them is a backup of one part of the system, so you get a homeassistant.tar.gz and one for each addon installed, eg cebe7a76_hassio_google_drive_backup.tar.gz. There is also some .json files containing metadata.

So yeah, all standard unix stuff from pre linux days :slight_smile:

1 Like

That was my fault, I did not think about that ))).
That is why sizes of that “tar” HA backup and my manually created “tar” are different…
Thank you for clarifications)))

BTW, I programmed on QNX in 1997-2006, but was mostly a programmer, not an admin, forgot about many *nix stuff.