How to restore a snapshot

Tags: #<Tag:0x00007f739086b5e0>

This guide has been updated to use the much easier method introduced in version 0.116, if you are running an older version of Home Assistant than this you can check the edit history of this post for the old instructions.

Note: this guide assumes you have copied the snapshot off your home assistant server before the problem occurred. So snapshot regularly and copy the snapshot eleswhere regularly. There are addons to do this automatically for you, here are a few:

To a NAS: Samba Backup: Create and store snapshots on a Samba share

To Goggle Drive: Hass.io Add-on: Hass.io Google Drive Backup

To DropBox: Hass.io Add-on: Upload hassio snapshots to Dropbox

To NextCloud: [New Addon] Snap-Shipper - Webdav backups (and probably other ways to later on)

If you have not done this, all is not lost. You may be able to recover the snapshot but it is beyond the scope of this guide.

1) Fix the issue that caused the crash.

There is little point restoring if it is just going to happen again.

For hardware this may be easy, e.g. replace a pi power supply or SD card.

For configuration issues, if you know what caused the crash you can make a copy of your snapshot and extract the relevant file using winrar, 7zip or some other compression software that allows decompressing .tar files. Edit the file and return it to the correct place in the snapshot. If you’ve done something incorrectly you still have the original snapshot to try again. Never edit this, only edit a copy. Alternatively, restore a snapshot that is older than when the issue was introduced.

2) Flash a fresh copy of home assistant to an SD card, or install using your preferred method

If it has been a while since you have done this the install instructions are here: https://www.home-assistant.io/hassio/installation/ alternative installation instructions are available in this community guide category.

3) Boot up home assistant, browse for your snapshot from the login page and restore

After a bit of time and a restart you should now have home assittant looking exactly like it did when the snapshot was taken.

Common issues:

The home assistant database or MariaDB database sometimes does not restore correctly. You can chose to repair this (search the forum for instructions) or delete it and start fresh. Home Assistant now has the ability to archive the database and create a new one on start up for the default database if corruption is detected but it does not always work as intended.

If you password protect your snapshot there is no easy way to recover individual files from it without first restoring the whole thing.

6 Likes

Great instructions @tom_l !

Can I just add another option for backups which I use which is the backup to DropBox:

A great addition. Go for it.

Edit: I had some other minor changes to make so I have also added the DropBox backup link.

1 Like

Since installation of 0.116.0 I got a lot of issues (mainly recorder) in the logs, decided to wait for an update, solutions seemed to be work in progress…
However after restarting my home-assistant install it was not reachable anymore. I could not get it to work again, so started with fresh install using whiskerz proxmox instruction, that worked fine.

Now let’s use the upload snapshot function… that results in:


(I get that message in Chrome, the new Edge does not report any issue).

:frowning:

How to proceed…?? I’ve tried restoring 116.0 and 115.x snapshots

edit: using 549mb sized snapshots

Next step I tried, completing the install of HA and Samba, copy back the backup. Then It complained:
[supervisor.snapshots.snapshot] Can't read snapshot tarfile /data/backup/e0ddd720.tar: "filename './snapshot.json' not found". It did execute the restore succesfully though.

12-10: I’ve checked the tar file, there is a snapshot.json in it and readable.

For anyone else with this issue it should be fixed soon:

1 Like