Snapshots are easily made in Home Assistant OS and are a service that can be automated. These can be made from the UI or the CLI (see below). They are stored in the /backup directory. Having snapshots handy will make it much easier on yourself. You can make changes without fear!
A full snapshot includes the following directories:
- config
- share
- addons (the manually installed or created addons)
- ssl
They also include a gzip file for each installed addon which contains the addon's version, config settings, and other data if any.
- Go to Supervisor > Snapshots in the UI
- Provide a name for the snapshot.
- Choose full or partial.
- Choose to password protect or not.
Warning - Password protected snapshots cannot easily be browsed outside of Home Assistant OS
- The only progress indicator at the moment is via the logs at the Supervisor > System page in the UI (or
ha su logs
in the CLI). - To update the snapshots page in order to see current snapshots, use the reload icon in the upper right of the page.
Restoring a snapshot on a fresh install of Home Assistant OS requires that you upload the snapshot to it. There is no way to upload snapshots from the snapshot dashboard at this time so the first thing to do is install and configure an addon of your preference. Samba, Configurator, or IDE are all good choices for this.
After uploading to the backup
directory, visit the snapshot page in the UI and reload the page using the icon in the upper right of the page to make the uploaded files visible. From there you can select your snapshot, choose a full or partial install and choose restore.
Note: Before restoring third-party addons, add their repositories to the addon store page first! These are any addons which are not in the official repo or the community addon repo. Nothing bad will happen, but those addons won't get restored. You can always add the repos and then go back and do a partial restore of the missing addons.
As long as a piece of string, as they say. The length of time it takes will depend on how much you have to compress or decompress. Large db files are the usual cause (the default db is home-assistant_v2.db found in config) and will take a long time to deal with on any of the pis.
TIP: The db files don't always restore well and you may need to delete the restored db altogether if you experience errors or wonky behavior. If you really want to keep long term historical data, look into offloading it to another machine/database that is more hardy.
See the recorder
component page for ways to keep your db data down to a size that won't cause issues. Note the keep days, purge interval, and include/exclude options. https://www.home-assistant.io/components/recorder/
When the restore is complete, you will lose connection to the UI and it will return just as though you had restarted Home Assistant. It can be a good idea to do an additional full reboot as well especially if addons appear to be missing from the restore. You can reboot from the Supervisor > System > Host System page.
YES! You can use the following:
ha sn list
to list snapshots and their slugnamesha sn restore slugname
to restore a snapshotha sn new --name nameofsnapshot
to create a snapshot
Use ha help
to see more info.
More automation and usage examples here
The snapshots will do you no good if they are on the device which you cannot access! Copy them off in batches manually from /backup on occasion. Or even better, make use of an addon like Google Drive backup or Dropbox Sync and automate it!
Samba backup is also a nice Add on to copy snapshots automatically to a remote Samba share:
https://github.com/thomasmauerer/hassio-addons/tree/master/samba-backup