HA identified corrupt //config/home-assistant_v2.db

Woke up this am and noticed history on my temp sensors was missing prior to 5am.
checked the logs and saw some alarming errors:

Logger: homeassistant.components.recorder.util
Source: components/recorder/util.py:338
Integration: Recorder (documentation, issues)
First occurred: 4:12:09 AM (1 occurrences)
Last logged: 4:12:09 AM

The system will rename the corrupt database file //config/home-assistant_v2.db to //config/home-assistant_v2.db.corrupt.2023-09-28T08:12:09.943539+00:00 in order to allow startup to proceed

This is running on an INTEL NUC with a M2 drive. Never saw this before in my 3 years running HA. Something to worry about?

SYSTEM:
Home Assistant Core: 2023.8.3
Home Assistant OS: 10.3

A corrupt database is a sign something has gone wrong.

It could a RAM fluke or a bad write, but you need to monitor daily in case it happens again. If it does it is time for a deep dive as your SSD might be on the way out or something more serious with your system.

Definitely not something to sleep easy.

1 Like

Thanks for confirming my suspicion. Been running fine since may, but will monitor.
Do you happen to know if there is a way to have HA Email or Notify me for that particular event?

You might want to use the following: Automation Trigger - Home Assistant

You can create an automation which fires a message when HA starts. You might want this to be notified any time HA starts, for whatever reason.

1 Like

Happened again :frowning:
So, on a windows system, I know how to run various diag tools to help narrow down the issue. But with HAOS what tools might be available for diag?
Its a brandy new NUC - deployed May 2023.

I suggest you consider upgrading HA to use MariaDB as the database engine. Then see if problem persists. If it does, most likely SSD faulty cells. Try to copy the VM and try to run the new VM without deleting the old VM. You will be using new SSD cells and hopefully issue will go away.

I appreciate the reply!
After doing some googling, I am reluctant to migrate to MariaDB, there was a video clip from the 2023.4 release party where dev actually suggested it was not a good idea as once you do that, they cant help.

As for the second suggestion, copying the VM and running the new one… it isnt in a VM, its running directly on the M2 in the NUC. The last two times its happened, it was between 2 and 4am. Are there perhaps some DB tools I could use to check the health?

If you have installed the Advanced SSH & Web Terminal Community add-on you can run htop which might capture which process is the culprit. You might even find something that should not be running.

One more add-on you can install is SQLite Web, which will allow you to peek into the database.

MariaDB is a very safe bet. I only run MariaDB on all important HAOS installs. You might have misread the statement about MariaDB?