On May 11th, it was the 2nd Sunday of the month, and thus Home Assistant or the recorder performed auto_repack of the database after auto_purge.
All data (logbook, history, etc.) from the last good 1.5 years, before May 11th around 5 a.m., is now gone.
I can only explain that something went wrong during the auto_repack. Because the timing matches with the date. Unfortunately, there is nothing to be found in the Home Assistant logs, no error messages. Interestingly, in the log itself, I can still go back further.
I did not configure the recorder separately or manually in the configuration.yaml. I was just in the developer tools > statistics and noticed that there are only a few entities present, and for these, only the long-term statistics or just the histories are still there.
I am still on Core 2025.4.4
Does anyone have any idea what might have happened and if I can recover the data (maybe restore a HA backup or use Proxmox to restore a backup of the VM)?
Unless you set it to do otherwise, your backups should have your database in them for recovery.
The fact that you are using a version of HA greater than a year old makes it very unlikely that we can diagnose the original problem. It’s best to keep up with the updates a little closer so we can better help you. Most of the tools that I know about won’t work on a 12mo old HAOS version.
Thank you very much for the quick response. I will probably try it with a backup then. By the way, there was an error in the year, Core 2025.4.4 is correct.
Thank you. I’m going to sleep over it for a night, which I do. I’ve never had to do either of them and I’m a little worried about breaking more than losing data.
If it helps you at all, no backup is any good it it’s never been tested and it fails when you really need it.
Always good to test it by restoring it, maybe to a new VM so you don’t mess the original?
This would also test your ability to restore if the disk dies or something.
Okay, I couldn’t stop thinking about it and tried the HA backup. But unfortunately that wasn’t successful either. After restoring, I have the following error messages in the log:
The system could not validate that the sqlite3 database at //config/home-assistant_v2.db was shutdown cleanly
and
Ended unfinished session
Unfortunately, the long-term data was then only available for one more month. Presumably because something was or is wrong with the database.
Now, of course, I wonder how reliable HA backups really are.
Then I tried to restore VM via Proxmox, but got the same error.
Perhaps Proxmox is also causing the problems. Very frustrating in any case.
The first text is just a warningand it is always present unless you close HA core down first and then shuts down HA host, which needs to be down with a command line then.
In most cases it is just a warning that can be ignored.
The second one I am uncertain of.
It looks like some text is missing in the message.
OMG! I apologize a thousand times. I must have had a total blackout!
I wanted to display the status of my UPS some time ago and, as I said, it only went back to May 11. Out of sheer excitement, I then looked at a light and it only went back to May 11. too. Then I was completely confused.
BUT this is completely correct, as neither lights nor the UPS entity have the state_class and device_class attributes that are required to be included in the long-term statistics. Standard history only lasts 10 days and May 11th was exactly 10 days ago today!
Too late
I had stopped the old VM and restored it from a backup. Proxmox had automatically created a new VM. After testing, I later deleted this new one and started the original one. So far it is running well and unobtrusively.