Best way to backup HA core in Docker

I’m running HA core via Docker on a Pi4 and since I’m starting to use it more and more I need to look at getting backups sorted sooner than later! My plan is to create a single backup file and to use rclone to back that up to onedrive for offsite storage. I was also looking to scp the file to another pi I already have running on the network that I can just spin up an immediate duplicate if my main device is down with little/no downtime.

If I were running it Haas.io it looks really easy to create a “snapshot” and that can just be backed up but I don’t think there’s anything out the box similar for core sadly? So in that case does anyone have any pre-made scripts they’ve used for a similar approach?

I’m guessing something along the lines of running the unix tar command on the home assistant directory ( (with the history db excluded) and then just backup that archive? Thanks!

Edit: I do have the configuration files backed up to Git regularly but I have a feeling it wouldn’t be an exact copy if I purely pulled those down and started another instance given things like .storage aren’t committed.

Yes, but remember to tar the hidden directories too.

Cool, I did try the other day but I was getting “File being changed” errors which I think might have been the db but I did have that set to exclude so I’m not sure on that one, I’ll have to try again. I’m guessing under the covers all the snapshot command is doing is triggering a basic tar command on the applicable dirs?

a snapshot on home assistant supervised is just a tarball :slight_smile: