How to keep your recorder database size under control

If you copy it over, be sure to shut down HA first or you’ll probably end up with a partial copy.

  1. shutdown ha
  2. make sure the wal and shm files are cleaned up to verify its not still accessing the db
# ls -l home-assistant_v2.db*
-rwxr-xr-x    1 root     root     876187648 Feb 13 23:00 home-assistant_v2.db
-rwxr-xr-x    1 root     root         65536 Feb 13 23:00 home-assistant_v2.db-shm
-rwxr-xr-x    1 root     root      21980232 Feb 13 23:00 home-assistant_v2.db-wal
  1. Copy the db to your local
  2. vacuum it to recover space.
SQLite version 3.38.5 2022-05-06 15:25:27
Enter ".help" for usage hints.
sqlite> vacuum;
  1. Copy it back to your instance
  2. start HA
1 Like