Hi everyone,
I’ve recently been working on optimizing my Home Assistant setup on a Raspberry Pi 5. Initially, I was running everything from an SD card, which worked fine at first, but I wanted to future-proof the setup and avoid SD card wear – especially because I’m using MariaDB as the recorder database, which generates frequent disk writes.
Here’s the general process I followed:
My Migration Steps
- I had MariaDB set up and running on the SD card, and it was working correctly with the recorder integration.
- Before migrating to SSD, I disabled the recorder by commenting it out in
configuration.yaml
. - I created a full backup via the Home Assistant GUI (Supervisor → Backups).
- I shut down the Pi and physically moved the installation to a new SSD setup.
- I flashed the SSD, configured it to boot, and then restored the backup from the previous SD card system.
- After confirming everything was running, I re-enabled the recorder integration and restarted Home Assistant.
However, since this migration, the recorder no longer seems to be working properly. Home Assistant boots, and I can log into the interface, but no new data appears to be written to MariaDB. Logbook and history stay empty.
I verified that the database itself is reachable – I can log into MariaDB and see the tables (like states
, events
, recorder_runs
, etc.). But it looks like no new entries are being written.
Things I’ve Tried So Far
- Confirmed MariaDB is running and accepting connections.
- Verified that the database still contains the correct tables (nothing missing or corrupt).
- Re-checked the
db_url
entry inconfiguration.yaml
. - Increased logging to
debug
level. - Checked if
recorder_runs
shows new sessions being logged (it doesn’t). - Ran manual purging via Developer Tools (→ Services →
recorder.purge_entities
) to test write access. - Set
db_max_retries
anddb_retry_wait
in the recorder config. - Ensured the Home Assistant container has access to the database host.
- Checked permissions on the MariaDB user (full access to the DB).
Logs (Excerpts)
txt
KopierenBearbeiten
2025-03-21 14:21:03.942 WARNING (Recorder) [homeassistant.components.recorder.db_schema_update] Database is not the expected schema version
2025-03-21 14:21:03.944 ERROR (Recorder) [homeassistant.components.recorder.util] Error during connection setup to mysql://homeassistant:password@mariadb/homeassistant?charset=utf8mb4: (MySQLdb._exceptions.OperationalError) (1049, "Unknown database 'homeassistant'")
2025-03-21 14:21:03.945 ERROR (Recorder) [homeassistant.components.recorder] The recorder could not start, please check the log and ensure your database is setup correctly and reachable
I’m looking for any advice or tips on what I might have missed or misconfigured. Is there anything I need to “reset” after restoring a backup and re-enabling the recorder on a new setup? Or could it be a schema issue due to the migration?
Thanks in advance for any help!
Cheers,
Matthias
1 post - 1 participant