I’m running HA on RP4 with 64GB SD card. My disk usage has gone up from 12% to 52% in 10 days. The biggest file is the home-assistant_v2.db which is 15GB while the 4 snapshots is around 10GB. How to reduce the home-assistant_v2.db?
Check the recorder docs and use the keep_days option to reduce the amount of data retained. I have mine set to 2 days.
With snapshots, use one of the add ons available to similarly retain x number of snapshots. I retain 5.
However I wouldn’t be too concerned.
Thanks for the fast reply. Where do I check the recorder doc?
Thanks for your help. This is heavy stuff. Need some time to read and digest. Appreciate your help.
Where do you put this code? In config.yaml?
Create this notification integration:
Copy to clipboard
- platform: file
name: entity_log
filename: /config/www/entity_log.txt
timestamp: false
Use the template editor method. No need to do that. It was an old method I used when I had trouble copying the results from the template editor. This method works much better now.
Ok. Got it
Hi, seems like cannot purge my database. Anyone can help?
Logger: homeassistant.components.recorder.purge
Source: components/recorder/purge.py:101
Integration: Recorder (documentation, issues)
First occurred: October 19, 2020, 1:42:05 PM (2 occurrences)
Last logged: 4:12:00 AM
Error purging history: (sqlite3.DatabaseError) database disk image is malformed [SQL: DELETE FROM states WHERE states.last_updated < ?] [parameters: (‘2020-09-07 20:15:17.040312’,)] (Background on this error at: http://sqlalche.me/e/13/4xp6)
Logger: homeassistant.components.recorder.purge
Source: components/recorder/purge.py:101
Integration: Recorder (documentation, issues)
First occurred: October 19, 2020, 1:42:05 PM (2 occurrences)
Last logged: 4:12:00 AM
Error purging history: (sqlite3.DatabaseError) database disk image is malformed [SQL: DELETE FROM states WHERE states.last_updated < ?] [parameters: (‘2020-09-07 20:15:17.040312’,)] (Background on this error at: http://sqlalche.me/e/13/4xp6)
Easy solution: delete home-assistant_v2.db and restart. You will lose your previous history.
Or you can search the forum on how to repair an SQLite DB. There are a few topics.
Great! I just delete then. No problem to loss some data. TQ.
Do I need to do anything to rebuild the database?
It is automatically recreated when you restart HA
Oic…Ok. TQ