A backup tool, with automated schedule, excluding db files (since they are usually large)

if it’s the root then it would just be

backup\database.db

But i don’t know how your installation is configured. It’s a folder structure. So all you need to do is browse to it and copy the location name.

It’s just a hassio installation on an rpi, never fiddled with the folder structure :stuck_out_tongue:
Will try it and report back, thank you!

Unfortunately it does not load recorder and all dependent components.


2019-11-26 08:34:32 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: Could not parse rfc1738 URL from string 'backup\database.db' (retrying in 3 seconds)
2019-11-26 08:34:35 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: Could not parse rfc1738 URL from string 'backup\database.db' (retrying in 3 seconds)
2019-11-26 08:34:38 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: Could not parse rfc1738 URL from string 'backup\database.db' (retrying in 3 seconds)
2019-11-26 08:34:41 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: Could not parse rfc1738 URL from string 'backup\database.db' (retrying in 3 seconds)
2019-11-26 08:34:42 WARNING (MainThread) [homeassistant.setup] Setup of recorder is taking over 10 seconds.
2019-11-26 08:34:44 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: Could not parse rfc1738 URL from string 'backup\database.db' (retrying in 3 seconds)
2019-11-26 08:34:47 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: Could not parse rfc1738 URL from string 'backup\database.db' (retrying in 3 seconds)
2019-11-26 08:34:50 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: Could not parse rfc1738 URL from string 'backup\database.db' (retrying in 3 seconds)
2019-11-26 08:34:53 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: Could not parse rfc1738 URL from string 'backup\database.db' (retrying in 3 seconds)
2019-11-26 08:34:56 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: Could not parse rfc1738 URL from string 'backup\database.db' (retrying in 3 seconds)
2019-11-26 08:34:59 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: Could not parse rfc1738 URL from string 'backup\database.db' (retrying in 3 seconds)
2019-11-26 08:34:59 ERROR (MainThread) [homeassistant.setup] Setup failed for recorder: Integration failed to initialize.
2019-11-26 08:35:03 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of history. Setup failed for dependencies: recorder
2019-11-26 08:35:03 ERROR (MainThread) [homeassistant.setup] Setup failed for history: Could not set up all dependencies.
...
2019-11-26 08:35:05 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of logbook. Setup failed for dependencies: recorder
2019-11-26 08:35:05 ERROR (MainThread) [homeassistant.setup] Setup failed for logbook: Could not set up all dependencies.

Had this idea for a while to, the right config would be:

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

Since i am not using HASSOS i’m not sure if /backup exists. This might cause an error (or maybe not if HA creates the path). I use this config:

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

I just tried it and it works, backup size is ± 30 MB :slight_smile:

Also take a look at Google Drive Backup LINK. This allows you to:

  • Schedule backups
  • Move the backups to the cloud
  • Keep backups for x days in HA
  • Keep backups for x days in Drive

Never lose your backups again!

Cheers :slight_smile: :beers:

Edit:
Oh, and don’t forget to remove the db file from /config :sweat_smile:

Edit2:
You might lose your log if you update HA, i didn’t try. I don’t know how HA updates with docker. I would say, it installs newest HA in docker_container2, copies /config /share /ssl etc and deletes docker_container1. In this case you would lose your db file because it does not copy /var (i think) :slight_smile:

1 Like

running HomeAssistant (HomeAssistant Core & Supervisor, old hassio) on docker is almost identical to running it on HassOS.

This is how I run it. And yes, backup exists.

Have to admit, I have been unsuccessful in relocating the database and have the same interest of being able to exclude the database file from the Snapshot. I think having it as a checkbox option during the snapshot process would be great, but relocating the database seems viable.

The documentation for recorder states:

db_url
(string)(Optional)
The URL that points to your database.

However, my efforts to use this to modify the location (including the examples in this thread) have failed with a Recorder could not load error. I am running HA Supervisor without any additional database architecture other than Recorder. The .db file is in my config folder as is typical. Could someone tell me what that URL would look like? With that, I can hopefully make the necessary modification to make it work for me.

Did you ever find a solution to this?

Nope, never figured out how to write the path if the db is in an different folder.

Hi,

I found this thread while searching for solutions for how to make snapshots without the database, and it got me on the right path for finding a solution/workaround for this.

I tried putting the database in the “backup” folder as well, but were not successful (might be due to file permissions or not specifying the correct path).

However as a test I was successful in putting the database in the “share” folder like this:

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

You can move your existing database file if you care about the data in it (should probably be done while HA is stopped) or just delete the old database file if you do not care about the data. HA will generate a new database file in the new location.

Then you can just run a partial backup and exclude the share folder from it.

NOTE: It might not be considered as “best practice” to place the database in the “share” folder, so you should do this on your own risk. So far I have only done this on my test instance.

1 Like

Hi, tried your solution but having an error


recorder:
  db_url: /share/db

2020-10-10 15:11:17 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: Could not parse rfc1738 URL from string '/share/db' (retrying in 3 seconds)

2020-10-10 15:11:20 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: Could not parse rfc1738 URL from string '/share/db' (retrying in 3 seconds)

2020-10-10 15:11:23 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: Could not parse rfc1738 URL from string '/share/db' (retrying in 3 seconds)

2020-10-10 15:11:26 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: Could not parse rfc1738 URL from string '/share/db' (retrying in 3 seconds)

2020-10-10 15:11:29 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: Could not parse rfc1738 URL from string '/share/db' (retrying in 3 seconds)

2020-10-10 15:11:32 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: Could not parse rfc1738 URL from string '/share/db' (retrying in 3 seconds)

2020-10-10 15:11:35 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: Could not parse rfc1738 URL from string '/share/db' (retrying in 3 seconds)

2020-10-10 15:11:38 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: Could not parse rfc1738 URL from string '/share/db' (retrying in 3 seconds)

2020-10-10 15:11:41 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: Could not parse rfc1738 URL from string '/share/db' (retrying in 3 seconds)

2020-10-10 15:11:44 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: Could not parse rfc1738 URL from string '/share/db' (retrying in 3 seconds)

2020-10-10 15:11:44 ERROR (MainThread) [homeassistant.setup] Setup failed for recorder: Integration failed to initialize.

Ok, I put as per your instruction


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

then in Home Assistant Google Drive Backup configuration I put (please note last row)


max_snapshots_in_hassio: 4
max_snapshots_in_google_drive: 4
days_between_snapshots: 3
use_ssl: false
send_error_reports: true
exclude_folders: share/db

annd it should be ok, right? Or I do have to change something in configuration to make only partial snapshot? I do not know where to

1 Like

Hi,
I’m not using Home Assistant Google Drive Backup, so I am not familiar with it besides knowing it exists.
But I did quickly check the documentation for it, and the answer is easily available there:

Can I exclude specific sub-folders from my snapshot?

The addon uses the supervisor to create snapshots, and the supervisor only permits you to include or exclude the 4 main folders (home assistant configuration, share, SSL, and local addons). Excluding specific subfolders, or only including specific subfolders from a snapshot isn’t possible today.

So this probably means you have to exclude the entire share folder.

exclude_folders: "share"

Can you do this if you don’t use Hass.io?

Nope, it’s part of the supervisor.

Are there any nifty tools available for users using ha in a docker container?

Outside of integrations, nope. You can attempt to pull the addon’s docker files and set them up in your environment

Not sure what you mean,could you elaborate?

Atm I just git push (almost) everything

Find the addon or ‘nifty tool’ that hassio has, take the docker file, adjust it for your system, and run it.

Correct. That’s how I have it setup and it works.

Hi Guys,
We really need a good official solution to get the backups automated AND automatically off of the device.

I know this is a can of worms with the options for ‘destinations’ but something really does needs to be done. I think a good clean start might be to NAS or other network share requiring ip/dns name, u/n and p/w easily configurable from the ui

I strongly feel this is more than a feature request, it is more of a requirement of any modern device or appliance with complex configs and custom scripts, automations and logging history.

There are many discussions on this topic in various threads all with unsupported and or incomplete examples, but I would only trust an official route on this important and necessary issue.

Many thanks guys/gals keep up the good work :wink: