What is the point of the backup option in docker?

Im struggling to work out the purpose of the backup option in home assistant in a containerise enviroment.

You cannot restore the backup without supervisor, so what is the point in even showing it?

1 Like

I would agree.
My old related issue on Github.
Ended up creating tar-files by myself (guess this native HA backup does the same tar file) & un-taring them manually.

If you want to move to HA OS, it is easy. Otherwise, no purpose.

1 Like

Yes, you can. You need to expand the archive yourself and then copy it back to /config.

3 Likes

Which then begs the question, why can’t homeassistant do that?

Because “simple” docker HA does not have a supervisor, and it cannot restore itself

But it has access to the volume, it has access to the backup file, so it could quite easily do it.

For some reason its been chosen not to allow it

Probably, while HA is running, things are written to ./storage and the database. Restoring files while they are being written to is not a good idea.

1 Like

Doesn’t seem like it’s impossible to resolve

Just seems a massive omission, if you provide backup, provide a means to restore.

There are a lot of people who can’t run a supervised environment.

For instance I can’t run a VM on my Synology without completely rebuilding my Synology drives to use btrfs. So I have to run docker.

People running a docker environment are assumed to be capable to untar a backup tarball :wink:

Statistically, you backup your data much more often than you restore it, so being able to take those backups from inside HA is just a nice quality-of-life feature.

1 Like

There are 2 (solvable) problems that needs to be handled before a restore feature can be added to instances without a supervisor.

The first one as mentioned above, is that it can not be restored while the instance is running.
That part is solvable by adding some sort of start-up flag like how safe mode is handled.

The second one is that on instances without a supervisor the version can not be upgraded/downgraded during restores.
This is important as the configuration should not be restored on a different version due to data structure conflicts.
That part is solvable by aborting the restore if the version does not match.

4 Likes

If you assume people are able to extract a tarball, you also buy inference should assume they can create one.

So I don’t see your point.

If home assistant paused whilst creating a backup you might have a point, but it doesn’t, you can change entities whilst a backup is happening.

Maybe you didn’t read my post thoroughly…

It might not be obvious, but HA is basically stateless between restarts.
The only stateful part is the DB, and you can very well start HA without a DB and it will just recreate one and be happy (loosing history, ofc).

So I consider backups useful, even if there is slight risk of DB corruption, which I basically don’t care, besides long-term statistics.
I am assuming that there isn’t actually a mechanism that prevents corruption, here, while it might very well be foreseen.

I read your post, but that assumption can go on and on and on if someone is supposed to be skilled to create a tarball then you could also claim they can also be skilled enough to create a cron job to do that regularly too.

If a backup is provided for ease of use, then a restore should also be provided for ease of use. It’s common sense.

Home assistant application is stateless yes, but the backup backs up the database, along with history, configuration files etc which contains the statefulness.

Of course they are. Not sure why the hate about being able to do that from inside HA with some UI and/or HA automations :wink:

Well, a restore procedure must exist, sure. That doesn’t mean that the restore must be done using the same tool than the one which did the backup.

Can you point me to where the documentation is for said restoration procedure?

As far as I can see that procedure doesn’t exist, the documentation on backups and restore is solely about haos.

Yet the backup functionality is provided in all installations.

I’m using duplicati for backing up my system. It runs as a service on my linux installation not as a docker container.
For now everything is working fine. I needed a few times to restore my config files, as I thinker around a lot, but no problems so far.

1 Like

Here is the procedure:

Now that you know, you are very welcome to enhance the documentation for others :smiley:

1 Like

Yeah, there are a bazillion ways.
Besides the DB, everything else in HA is text (YAML or JSON in .storage), so I just use git myself + a dose of borg backup for good measure.

I actually only use the builtin backup as a quick way to save the config before doing fixes due to braking changes between releases.

And we have gone full circle… :roll_eyes:

Exactly the point of the post, there is an official backup (the UI) but no official restore (no UI or Documentation).

As I haven’t done a restore I can’t update documentation, but as you seem to know a lot about it…