Create a backup to restore without any additional manual work?

Hi everybody,

my Home Server crashed a couple of days ago. Luckily, I had a “full” backup, or so I thought. Home Assistant ran as a docker container, and the entire directory linked to Home Assistant was a git repository stored on my local git server (including .storage and .cloud).

Now I installed hass on a spare raspberry pi 4, because the server has to be repaired. I installed docker and docker-compose, copied my backup, then ran docker-compose up -d on the compose file.

Home Assistant started. However! I am missing the following things - at least those, they were what I noticed instantly. Perhaps there is more

  • tokens created by my user
  • all my areas that I manually created
  • all integrations, for example WLED devices, all tasmota devices added via mqtt, zigbee2mqtt devices added via mqtt
  • hacs integration

Also, everything HACS related was missing. The hacs folder is part of this hass root folder that I backed up. So I thought at the most I’d have to re-install hacs, it would recognize the settings (github token, installed integrations), and run. But I had to manually do all this.

As I am currently manually re-installing everything, anyway, it is too late. But I’d like to have a complete backup when switching back to my Home Server once possible. What do you suggest I do?

Where are files saved other than in the hass root directory, that I’d need to include in my backups from now on?

Thank you in advance for your support :slight_smile:

They’re all in the configuration directory, but lots are in hidden files/folders (denoted by a preceding . )

You would need to setup your gitignores etc to keep these items.

Of course the ‘official’ way to do this is to use the native backup system in homeassistant (full), which can be run as a supervised install if you prefer not to use one of the images.

I gave up on GIT after my last failed rollback. This is what I run now…

#!/bin/bash

docker stop nodered
docker stop hass
docker wait hass


TIME=`date +%b-%d-%y-%s`
FILENAME=hass-backup-$TIME.tar.gz
SRCDIR=/home/wuench/hass
DESDIR=/mnt/cifs/backup/hass
tar -cpzf $DESDIR/$FILENAME $SRCDIR

docker start hass
read -t 30 -p "Waiting for HASS Startup ..."
docker start nodered