Exclude database from backup

Like many here, my db file grows by hundreds of MB per day and would not be needed in the case of a Restore. Regular snapshots should be a habit for HA users and easily bypassing the database file would dramatically facilitate and expedite this.

Carrying on the discussion from here, I am requesting an option for the Snapshot function that excludes the home-assistant_v2.db file. Having unsuccessfully fought with relocating the database and with implementing MariaDB solely to allow for snapshots without the db file, I now wonder if this is a more viable option.

Well, after so many attempts, I have finally solved the MariaDB configuration. However, I still think this would be a valuable addition to the Snapshot functionality.

I don’t need it and it often gets corrupted in my snapshots anyway.

I moved my sqlite database to /share, and exclude /share from the snapshots.


How did you do that? How did you tell HA that you moved the database to the new location? :slight_smile:

I can see that a similar question was raised in the following:

So your answer could probably help them as well :slight_smile:

In configuration.yaml :

  db_url: sqlite:////share/hassio_db/home-assistant_v2.db  
  purge_keep_days: 3
1 Like

Can you do the same with MariaDB?
I understand that the database created by the add-on lives in the MariaDB docker container so I guess that your solution would be impractical in that case.
Anyone knows how to change the default location of the MariaDB database?

Hi @francisp ,
How do you exclude a directory from the snapshot?
My purpose is the same: create a full backup, without the home-assistant_v2.db

I’m running hass in docker on a rpi, so in my case, I would like to make a full backup of \\rpi\usr\share\hassio without the home-assistant_v2.db file

I don’t know how to do that on a docker installation. I run a supervised installation, and in the google drive backup add-on, you can simply click what you want to exclude.