HA - All Sensor History Keeps removing

Hi Guys, Thanks for helping. So, in a nutshell:

A couple of months ago I upgrade my setup from a RasPi4 (4GB) to a RasPi 5 (8GB). I took a backup from my Google Drive, which was created by the “Home Assistant Google Drive Backup” Addon.

The new installation went fine, and I didnt ran into any issues at all. Also the import of the DB took a while, but no errors shown and all my integrations/sensors/dashboards were available on the RasPi 5. Hooray!

Fast forwards to today

I have intermittend issues with the history of my data. To be specific; It looks like HA is perging the DB at random times. I couldnt find any connections so far to an issue in the logs, or any crashes in the system.

But it sucks… It kinda gives me a feeling that it has something to do with the upgrade, or maybe a DB bug?

Im at the point where I just completely want to rebuild me setup… But that is kinda cumbersome. Does anyone have an idea how to proceed?

For example:

  • Can I reset the DB in way that all the integrations/Automations/entities/addons remain, but not the counter sections resetted?
  • How would one go ahead and rebuild the whole new environment?

Your issue might be due to storage space, which can corrupt the DB when the disc becomes full, so check that and maybe look into handling the recorder and logger, if you have not done that already.
It can eat up space quickly if you have some chatty sensors.

If you want to delete your DB, then we need to know which type you use.
Do you have InfluxDB and/or MariaDB installed as addons?

I doesnt look storage space related. I have System Monitor Integration running, disk usage is between 25,3 and 25,5% for the last week.

I havent installed any DB addons like MariaDB or influxDB.

Then you are using the SQLite version, which is a file called home-assistant_v2.db in your config library.
It can just be deleted and then HA can be restarted.
There might be files called home-assistant_v2.db-shm and home-assistant_v2.db-wal which should also be deleted then.