Hi all,
I have a Home Assistant Core installation (i.e. virtual python environment on Debian). I would like to create backups via cron cron jobs, and store to a path of my choice (this could be an external USB, a Dropbox path, NFS mount from other machine etc.)
My question is: is it safe to take a snapshot (for example using rsync
of the contents in /home/homeassistant/.homeassistant?
) I am worried about the SQLite data base files: do I need to shut down home-assistant or use some special script to create a consistent copy of those, or can I assume that a simple copy of the files to a different location will be sufficient?
More details:
-
at the moment, I am shutting down Home Assistant before I take the backup (all via cronjob), then start Home Assistant again (to be sure the data base files don’t change while I read them for the backup). This seems suboptimal. Also, the mobile clients seem to need restarting each time I have restarted the server.
-
I have search the forums for guidance on this topic. There is a description of how to upload backups to Dropbox here, and how to copy the files to a USB drive here.
Both methods refer back to this script to do the actual copying. This looks like it is working very similar to
rsync -auv
, excluding some files. It appears not to do anything special with the data base files though.This would support the hypothesis that it is safe to take copies of the files in
.homeassistant
for backup purposes with shutting down the server?
Many thanks,
Hans