How do I create a Backup via CLI only?

Hello everyone,

unfortunately, my Home Assistant spontanesouly disintegrated into a state in which it cannot boot anymore due to a docker error. I created a topic here. Effectively, Home Assistant is stuck in the setup stage, as it cannot install a docker container (see the topic above for more info if you are interested).

In that post, it was recommended to me to create a backup and then starting over from scratch. But, I dont know how.
Therefore the question: How can I create a full back-up of my Home Assistant installation using only the CLI?
I could not find a suitable tutorial or description for this task.

Bonus points for giving insights into how I can download this backup from the RPI. Can I use a USB-Stick?

Thanks for your answer in advance,
Phil

P.S.: My Home-assistant is running on a stand-alone Raspberry Pi 4

ha backup --help

I tried that, however when I for example do

ha backup new

the CLI only returns

Processing... Done.

Error: system is not ready with state: setup

You could use Linux Reader to copy the /config directory (assuming it is not corrupt). Then do a new install, get the Samba Share Add-on, and copy the old /config back.

ah, that would also copy the content of the mariadb right?

Why would I need Linux Reader for this? Couldn’t I just login to gain access to the system underneath and then copy the complete folder to a usb stick?

I don’t know how to do a copy from the CLI. I do know that removing the media and using Linux Reader works.

P.S. It probably would have been good keep the discussion to the old thread.

I agree, but as (in my experience is often the case), that thread went dead. Unfortunetaly, I find getting support is sometimes a bit difficult…

Having said that, I failed to understand that you meant that I should remove the SD card and insert it into my PC. Thats actually a good idea! I tried using LinuxReader, but I failed to locate the /config folder. Can you tell me where to find it? Here is a screenshot of what I see.


(forgive me if that is a very newbie question…)

/config should be in the first folder.

If you still have CLI access to the RPi you can enter the shell as you showed earlier (login) then

cd /mnt/data/supervisor/homeassistant

This is the home assistant docker config directory. ls -la should show all your configuration files. If they aren’t there, you’re probably out of luck.

If they are there, you can probably copy them with scp on either another Linux or Windows 10 machine if you have enabled ssh access to the host (Usually on port 22222).

You can prevent this in the future by having good backups that are copied off your system: Disaster Recovery Planning.

Good Point, as posted in the other thread, the back-up was not needed in the end, but I will backup my system now more regularly!