Add-on: Home Assistant Google Drive Backup

Hi, just wanted to know if there is any tip to exclude a single file (home-assistant_v2.db) from backup.

Thanks.

Just move your DB to a folder and then don’t include that folder in your snapshot.

eg:

recorder:
  db_url: sqlite:////database/home-assistant_v2.db

Specific files can’t be excluded, only one of the folders (media, config, ssl, backup) or an addon. This is a supervisor limitation and isn’t something the addon will ever be able to support unless the supervisor changes. To exclude the database file you’ll need to use partial snapshots and either:

  • Move the database file into a folder you can exclude as @sparkydave pointed out.
  • Install an addon that takes over the database (see here) and exclude that addon from snapshots. this is what I do.

Sorry, I didn’t understand something there. If I create a backup folder in the config folder as shown in your example, then this folder is also backed up.

Or where can I exclude it? I can’t find any option in the settings of the Google Drive backup!

Sorry, the example is slightly wrong. The database folder should not be inside the config folder. I’ve just edited the post

Ok, if I create the directory database outside the Config folder, then HA cannot do anything with it. Do I have to enter anything else in another place?

Are you sure about that?

I’m not using the standard SQL database so my config is different.

Truly Amazing! Stuff like this makes HA so fun and productive! This solution worked flawlessly and was full featured, well thought-out and solved a valuable need!

Thank you for making great stuff!

icing in the cake! thanks for this plugin!

So this addon saved me recently where my home assistant just completely broke… i had to reinstall and restore my snapshot which worked (for most things) but ironically now this addon won’t run. When I manually start it in the GUI I get:

" Failed to start add-on"
“404 Client Error for http+docker://localhost/v1.41/containers/create?name=addon_cebe7a76_hassio_google_drive_backup: Not Found (“No such image: sabeechen/hassio-google-drive-backup-amd64:0.104.3”)”

It doesn’t create anything under logs. I haven’t done much else other than search google for an answer. Should I try removing the addon and go thru the install process again?

1 Like

I’ve had a few users report this issue before (relevant issues). I’m unsure what causes it, though I’ve never had someone unable to resolve it. As far as I can tell, HA sometimes gets into a state where it is convinced the addon’s docker image has been downloaded, but it actually isn’t. Sometimes it goes away by itself after a few days. I’ve never been able to reproduce it on any of my test machines. Others have had success trying the following:

  • Restarting the host machine
  • Uninstalling and then reinstalling the addon
  • Unistalling the addon, removing the repository, and then adding them both back.

If you reinstall the addon, make sure you save the config (the yaml) somewhere so you can copy them back easily when you reinstall. If you have any insight into what fixes it for you or what caused it, let me know since its a bit of a mystery. There is probably some log message in the supervisor that got printed out when you restored from backup that could shed some light on it, but thats long gone by now.

I just did an uninstall/reboot/reinstall. Just had to reauth to google drive and all is well. Was fairly painless.

Hello,

I read the original post and have a very basic question: Will this add-on create a backup that I can use to restore my whole home assistant installation in case anything breaks (hardware or software wise) ?

I use:
raspberry pie with raspbian + HASSIO as docker installation + conbee II with deconz addon within Home Assistant

I ask because will this save my conbee II / deconz configuration with all lights and scenes attached?

THANK YOU

edit: one other question: I performed my first backup and it created a file called “Full Snapshot 2021-07-20 10:26:55.tar” - does this cointain all the add-ons like deconz or mosquitto-brooker already?

Yes, thats what the addon is supposed to do. The snapshots it creates are exactly the same as the ones created when you go to “Supervisor” > “Snapshots” in Home Assistant, which are designed to back up everything from an installation. In fact this addon just asks the supervisor to create snapshots and then takes over from there to upload it to Google Drive.

Full snapshots like the one you made contain everything in the /config, /share, /ssl, /media, and /addons folder as well as configuration and data for each of your addons. You can click on a snapshot in the web-ui to see what folders and addons are included in it, and if you’re ever unsure whats inside you could also extract the snapshot (its just a tar file) and look inside yourself.

1 Like

Your extensive reply is much appreciated! I in fact extracted the TAR file and all addons were included! Great!

The reason I came up with the question about whether the TAR file includes all addons is, that for some addons a dedicated TAR was created but not for all of them:

image

But now that I have a full snapshot I dont seem to need that files anymore?

anyways, thank you for the great addon and the community support

1 Like

Those smaller snapshots (addon_XXX_XXX.tar and core_XXX.X.X.tar) are ones that Home Assistant makes for you when you manually update an addon or Home Assistant unless you un-check the “Snapshot” option on the update dialog. Inside them is a backup of only the thing that Home Assistant updated, either a single addon or the /configuration folder. The addon by default will back up all snapshots it finds to Google Drive, not just the ones it creates. Most people making full snapshots with this addon prefer not to have those backed up to Google Drive because the addon won’t make a snapshot on its regular schedule if one of these smaller auotmatic ones were made recently. To do that you can either:

  • Use the “Ignore other snapshots” or “Ignore upgrade snapshots” options in the addon settings to make it completely ignore these snapshots.
  • Remember to always de-select the “Snapshot” option when you update things. I wish HA had a way to make that option default-off.

Thanks @sparkydave it worked! On my side due i run it from suppervised (docker) the official documentation did not help. For another users running docker the config will looks like:

db_url: sqlite:////config/database/home-assistant_v2.db

Thanks @sabeechen i moved the db to the media folder but addon gave me an error when i try to save the media exlusion setting. I’m missing something?

i tried with media and /media. No luck

Thanks in advance

TL:DR - seems there is a conflict when the system initiates snapshots - caused the latest, manual, full snapshot to be purged.

Updating my system and took a full snapshot, then updated an Installed add-on (via supervisor) which triggered a partial snapshot of that component (I forgot to switch it off).

Then tried to take another full snapshot from your WebUI. This indicates it is a partial snapshot not a full snapshot though the logs seem to indicate a full snapshot (still in progress).

07-28 16:39:16 INFO [backup.ha.hasource] Requesting a new snapshot
07-28 16:39:16 DEBUG [backup.ha.harequests] Making Hassio request: http://hassio/snapshots/new/full
07-28 16:39:51 DEBUG [backup.ha.harequests] Making Hassio request: http://hassio/addons/self/info
07-28 16:39:51 DEBUG [backup.ha.harequests] Making Hassio request: http://hassio/info
07-28 16:39:51 DEBUG [backup.ha.harequests] Making Hassio request: http://hassio/core/info
07-28 16:39:51 DEBUG [backup.ha.harequests] Making Hassio request: http://hassio/supervisor/info

Once finished, it said ‘full’

However, the last full snapshot I triggered manually, seems to have been deleted! (this is the most worrying one!)

I did see it in the log file, but the log of that has gone as I have thousands of these messages

07-28 16:48:44 DEBUG [backup.worker.watcher] Backup directory modified event
07-28 16:48:44 DEBUG [backup.worker.watcher] Backup directory changed
07-28 16:48:44 DEBUG [backup.worker.watcher] Backup directory modified event
07-28 16:48:44 DEBUG [backup.worker.watcher] Backup directory changed
07-28 16:48:44 DEBUG [backup.worker.watcher] Backup directory modified event
07-28 16:48:44 DEBUG [backup.worker.watcher] Backup directory changed
07-28 16:48:44 DEBUG [backup.worker.watcher] Backup directory modified event
07-28 16:48:44 DEBUG [backup.worker.watcher] Backup directory changed
07-28 16:48:44 DEBUG [backup.worker.watcher] Backup directory modified event
07-28 16:48:44 DEBUG [backup.worker.watcher] Backup directory changed
07-28 16:48:44 DEBUG [backup.worker.watcher] Backup directory modified event
07-28 16:48:44 DEBUG [backup.worker.watcher] Backup directory changed

Great add-on though :slight_smile:

[edit]
After uploading the new full snapshot, it deleted the partial snapshot!

07-28 16:56:28 DEBUG [backup.drive.drivesource] Uploading Full HASnapshot 2021-07-28 16:39:16 100.00%
07-28 16:56:28 DEBUG [backup.drive.driverequests] Making Google Drive request: https://www.googleapis.com/drive/v3/files/xxxxxxxxxxxxxxxxxxxxxx/?fields=id%2Cname%2CappProperties%2Csize%2Ctrashed%2CmimeType%2CmodifiedTime%2Ccapabilities%2Cparents%2CdriveId&supportsAllDrives=true
07-28 16:56:29 INFO [backup.drive.drivesource] Deleting 'addon_7ad98f9c_zigbee2mqtt_1.15.0' From Google Drive
07-28 16:56:29 DEBUG [backup.drive.driverequests] Making Google Drive request: https://www.googleapis.com/drive/v3/files/xxxxxxxxxxxxxxxxxxxxxxx/?supportsAllDrives=true
07-28 16:56:30 INFO [backup.worker.watcher] Backup directory changed
07-28 16:56:30 DEBUG [backup.model.syncer] Sync requested by Backup Directory Watcher
07-28 16:56:30 INFO [backup.model.coordinator] Syncing Snapshots
07-28 16:56:30 DEBUG [backup.ha.harequests] Making Hassio request: http://hassio/snapshots

@baz123 It definitely looks like you’ve run into some kind of bug. I’ve made an issue on github for you, I’d prefer to discuss it there since it gets messy to go back-and-forth in the forums. I’ve asked some questions there that could help me dig into whats going on.

Since the addon is misbehaving for you, I’d recommend you copy any snapshots you definitely don’t want to lose onto your local computer just in case.

1 Like