The /config volume on the Home Assistant VM in our test home hit 95.6% capacity with only 1.36 GiB free. The recorder database (home-assistant_v2.db) had swollen to 9.97 GB.
Nothing warned us. The disk-usage automation had never triggered. Free space was shrinking by megabytes between checks a few minutes apart.
Our first assumption was that the purge was broken. Instead, an integration added about three weeks earlier was generating 87% of all recorder churn. Fixing the database size required more than just excluding entities; it required understanding why the disk alarm failed and why standard maintenance couldn’t reclaim space.
The False Alarm
The first clue was the disk usage sensor itself. The automation was configured to trigger when usage exceeded 90%. However, the sensor returned values in GiB, not percentage.
The /config volume was approximately 31 GiB. The sensor value capped out around 28. The threshold of 90 was unreachable. The automation’s last_triggered timestamp was None. It had never fired.
This was not an isolated incident. Five other “system” sensors on our system had the same kind of problem: a wrong unit or a hardcoded value. One memory sensor reported values like 2261.2% because it was reporting MiB against a percentage threshold. Another “array free” sensor was hardcoded to the string “8.0 TB” regardless of actual free space.
The root cause was a unit mismatch, not a logic error. A disk alarm that cannot fire is just furniture.
The Real Culprit: SPAN Integration
We checked the recorder configuration. purge_keep_days was set to 30. The history API confirmed it: sun.sun had entries at 29 days but none at 40 days. The solar power sensor had 274 rows per two hours at 29 days, and zero at 40 days. The purge was working exactly as configured.
The database was simply still filling: new data was arriving faster than 30-day-old data was leaving.
The source was the SPAN smart electrical panel integration. It had been installed 20 to 29 days prior. The integration manages 242 entities. Of those, 130 were actively writing to the recorder.
One specific sensor, current_power, was generating approximately 17,000 rows per day. Across the entire integration, the SPAN devices accounted for 87% of all recorder writes.
The database was still growing toward its 30-day equilibrium. At the current rate, it would take another seven days to stabilize. The disk had only 3.6 days of runway left.
Checking Before Excluding
Before excluding any entities, we checked the Energy dashboard configuration. The dashboard is stored in .storage/energy. We checked this file to make sure no SPAN sensors were being used for energy history.
The dashboard used no SPAN sensors. Excluding them would not break the energy history.
The SPAN app already provides per-circuit history, so that data did not need to be in the recorder database as well. What we kept was total house power, net grid power, the two main-meter energy totals, and battery level.
We excluded 156 sensors and kept five panel-level entities. Every per-circuit sensor went. Breaker switches, circuit-priority selects, and binary sensors were left in the recorder. These entities only write when their state changes, so they add negligible overhead.
The Fix
We updated the recorder configuration in configuration.yaml.
recorder:
purge_keep_days: 30
commit_interval: 30
exclude:
entity_globs:
# No kept sensor ends in either suffix, so these are safe as globs and
# also cover any new circuit added later.
- sensor.span_panel_*_current
- sensor.span_panel_*_net_energy
entities:
# ...plus explicit per-circuit power/energy sensors
Then we restarted Home Assistant. In our experience the recorder configuration is only read at startup, so a YAML reload is not sufficient.
We also deleted 14 old backups and kept the newest six. The automatic backups had grown from 0.58 GB to 4.17 GB over five weeks. With only 4.1 GB free, the next backup would not have fit. Deleting the 14 oldest freed 2.76 GiB.
With both changes in place, disk usage went from 95.6% to 86.8%. Daily growth slowed from approximately 400 MB to about 100 MB, and a later measurement over 1.5 hours (4,247,108 to 4,244,832 blocks) worked out to about 36 MB per day.
Why the Database Didn’t Shrink Automatically
The database file did not shrink after the exclusion and the restart.
SQLite does not return freed pages to the filesystem. The file size remains large until a VACUUM operation is performed. A VACUUM needs free space at least equal to the size of the database to rebuild the file; the recorder documentation gives the same rule for a repack.
The /config volume was about 31 GiB and the database was about 10 GB. Even with every backup deleted, there was not enough free space to vacuum the database.
The only real fix was to grow the VM disk. We increased the virtual disk from 32 GiB to 64 GiB the next day. This provided the necessary headroom for future maintenance.
Fixing the Disk Alarm
We replaced the broken system sensors with real values, added a new sensor that reports HA disk usage as a percentage, and added an automation that warns at 90% and 95%.
Check last_triggered on every safety automation. If a critical automation has not triggered in months, verify that it can. Check the unit a sensor actually returns, not the unit it is labelled with.
Summary
On our system the database bloat was caused by the SPAN integration, which accounted for 87% of all recorder writes. Excluding per-circuit sensors reduced the write rate significantly.
The disk alarm did not fire because the sensor reported GiB instead of percentage. A threshold of 90% was unreachable when the maximum value was 28 GiB.
The database file size did not shrink because SQLite requires free space to vacuum. Growing the VM disk was necessary to allow future maintenance.
Check your recorder exclusions. Verify your sensor units. Ensure your disk alarms can actually fire.