How to restore a backup

The backup is a compressed archive. You can extract the contents with 7zip or similar.

Copy the the /config folder and its contents from the backup to your system /config folder and restart.

With all respect, having backup functionality without restore functionality is absurd, especially when the only advice I’ve found so far (as a newb) for migrating from Container to OS or from one machine to another is “do a backup and restore” (TBF, I may have stumbled upon a minority view).

Backup / restore is a basic function of any computer system, and must be as easy as possible because there are only two kinds of computer users: those who have had to restore a backup; and those who have not had to restore a backup yet.

This is the sort of thing that renders a system unusable by non-techies and undesirable for techies who value their time.

4 Likes

I’ve extracted the data from the .tar (obtaining a core_2022_10_4 directory), and then from the target.gz (obtaining a data directory) but there is no /config folder.

the data directory contains:

total 45144
drwxr-xr-x@ 18 evan  staff       576 Oct 21 09:56 .
drwx------@  6 evan  staff       192 Oct 21 09:56 ..
-rw-r--r--@  1 evan  staff      6148 Oct 21 09:59 .DS_Store
-rw-r--r--@  1 evan  staff         9 Oct 17 16:13 .HA_VERSION
drwxr-xr-x@  2 evan  staff        64 Oct 17 16:13 .cloud
drwxr-xr-x@ 23 evan  staff       736 Oct 20 17:04 .storage
-rw-r--r--@  1 evan  staff       518 Oct 18 17:05 automations.yaml
drwxr-xr-x@  2 evan  staff        64 Oct 20 17:04 backups
drwxr-xr-x@  5 evan  staff       160 Oct 21 09:56 blueprints
-rw-r--r--@  1 evan  staff       220 Oct 17 16:13 configuration.yaml
drwxr-xr-x@  2 evan  staff        64 Oct 17 16:13 deps
-rw-r--r--@  1 evan  staff      5779 Oct 19 04:47 harmony_12355857.conf
-rw-r--r--@  1 evan  staff  23080960 Oct 20 17:04 home-assistant_v2.db
-rw-r--r--@  1 evan  staff         0 Oct 20 17:04 home-assistant_v2.db-wal
-rw-r--r--@  1 evan  staff         0 Oct 17 16:13 scenes.yaml
-rw-r--r--@  1 evan  staff         0 Oct 17 16:13 scripts.yaml
-rw-r--r--@  1 evan  staff       161 Oct 17 16:13 secrets.yaml
drwxr-xr-x@  3 evan  staff        96 Oct 20 09:37 tts

Is that what you mean by “the /config folder”

That works, except for the detail that the historic data does not appear to have been restored.

So the basic mechanism to do a restore on HA Container is:

  • decompress each level of the backup file
  • move the folder containing ‘configuration.yaml’ to the pi (including hidden files and directories deep copied)
  • move the restored data into the config directory of the container (docker, in this case)
  • restart HA Container

Does not work for me.

What I did is extract the backup file.
This is the listing:

a0d7b954_bitwarden.tar.gz	addons_local.tar.gz		core_duckdns.tar.gz		homeassistant.tar.gz		ssl.tar.gz
a0d7b954_ssh.tar.gz		backup.json			core_nginx_proxy.tar.gz		media.tar.gz
a0d7b954_wireguard.tar.gz	core_configurator.tar.gz	core_samba.tar.gz		share.tar.gz

When I try to extract a *.tar.gz file I receive an error message.

% tar -xf core_duckdns.tar.gz 
tar: Error opening archive: Unrecognized archive format

Reading through the forum I see the workaround is to store the backup without a password. If only I would have know earlier!!

This is a major setback, causing me possibly to loose valuable information. And, even worse, my trust in this project.

I have had a crash before and was able to restore my backup then. When loading HA for the first time an option was displayed to perform a restore, instead of creating a new HA instance from scratch.

It has been a couple of months since the previous reply. Is there a solution known to this issue?
issue: how to perform a restore of a password protected backup

Any help is appreciated.

Decrypt backup:

Extract and copy as explained above.

You need to add the ‘z’ parameter to uncompress the archive at the same time. I also add the ‘v’ parameter to get a verbose output and you can omit the hyphen if you want.

tar -zxvf core_duckdns.tar.gz
tar zxvf core_duckdns.tar.gz

I have a tip that may help someone to avoid wasted time and frustration.

I backed up my Generic x86-64 install to bare metal while it was early in the setup phase. Then as a test, did a restore. All went well so I started adding integrations, add-ons and a handful of devices. No problem until I got to Zigbee2MQTT. It refused to run. Some authentication problem. But Meross using the same MQTT broker was fine. Then, Samba and SSH … installed, but would not start.

The solution I found was really simple. I had just been doing the Developer Options restart. A full hardware reboot solved them all.

I have raised a new instance so I can upgrade python version.
I did a backup on the old instance.
Moved that backup into .homeassistant/backups/ on the new instance
Rebooted.
And now in the login screen doesn’t show up anything that allows to restore from a backup.

No “Alternatively you can…”
And System->Backups doesn’t also have any way of restoring.

Restoring a backup is not possible in HA anymore?

What installation method did you use?

See the table here and take particular note of the two footnotes. Depending on your install method you may have to do a manual restore, even though you can backup via the UI.

I have a Core installation, because I run it on a Proxmox Lxc container.
So I see that restore is only manual. In fact I’ve already done it the manual way.

In my case, as I’m moving from python 3.9 to 3.11, I’m concerned about the integrations and other components versions become “corrupt”.
For example, now I have the “SmartThinQ LGE Sensors” integration that I can’t load, even when I have redownloaded it. It complains about python dependencies:

Setup failed for custom integration smartthinq_sensors: Requirements for smartthinq_sensors not found: ['cchardet>=2.1.7'].

And

Unable to install package cchardet>=2.1.7: ERROR: Cannot install cchardet>=2.1.7 because these package versions have conflicting dependencies. ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

EDIT: I’ve already seen that this is a problem with the integration on python 3.11: dependency cchardet cannot be installed on python 3.11 · Issue #507 · ollo69/ha-smartthinq-sensors · GitHub

I don’t know if I’m getting more of those problems. I can see another complain in logs about ffmpeg folder not present.

I have a HAOS install, I do have google drive backup but it is two days old, but my local copy of backup is from yesterday. How can I retrieve it?
My issue was with new HAOS 10.0rc1, since updating it, HA is using too much ram upto 96% leading to very slow or non-responsive HA.

No idea as you have not told us about your system hardware. However…

You don’t need to restore a backup to roll back the OS to a previous version. Just use the CLI:

ha host update --version x.y.z

I assume there was a reason for you to run a pre release candidate?

I am running HAOS on RPi4 2Gb.
I can ping the server easily.
but opening the dashboard results in connection refused or takes too long to load dashboard

How do I access CLI while system is being ultra slow.
SSH from VScode is losing connection time and again


addon tab is missing in setting

  OS Version:               Home Assistant OS 10.0.rc2
  Home Assistant Core:      2023.3.6

this is the version for the current trouble.

With an SD card or SSD?

Edit: actually it does not matter. Either way remove t/he media and connect it to a Linux PC. Or a Windows PC using DiskInternals Linux Reader. You can then find and copy the backup. I do not know exactly where it is but there are other posts about this on the forum if you search.

SSD, I tried using Kali linux in WSL but it didn’t worked.
let me the disk internals linux reader.
It is in under /backups folder isnt it?

what the exact command to restore to HAOS 9.5?

ha host update --version 9.5

this isn’t working throws a flag error.

as for the backup


image

ha os update --version 9.5

it isn’t in the documentation?

Common Tasks - Operating System - Home Assistant

No it isn’t. That’s where I got the host command from. I got the os command by using the CLI help file.