Hello,
I have these sensors in HA:
- platform: systemmonitor
resources:
- type: disk_use_percent
arg: /
- type: disk_use
arg: /
- platform: filesize
file_paths:
- /config/home-assistant_v2.db
I’ve observed that both eventually grow without explanation to me. The home-assistant_v2.db
file has a constant size. I attach a graph:
I’ve checked in ssh terminal executing df
and du
commands.
➜ ~ df
Filesystem 1K-blocks Used Available Use% Mounted on
overlay 29941192 5756692 22939532 20% /
tmpfs 1960060 0 1960060 0% /sys/fs/cgroup
/dev/root 98816 98816 0 100% /sbin/docker-init
/dev/mmcblk0p8 29941192 5756692 22939532 20% /data
/dev/mmcblk0p8 29941192 5756692 22939532 20% /ssl
/dev/mmcblk0p8 29941192 5756692 22939532 20% /addons
/dev/mmcblk0p8 29941192 5756692 22939532 20% /share
/dev/mmcblk0p8 29941192 5756692 22939532 20% /config
/dev/mmcblk0p8 29941192 5756692 22939532 20% /media
devtmpfs 1926268 0 1926268 0% /dev
tmpfs 1960060 0 1960060 0% /dev/shm
/dev/mmcblk0p8 29941192 5756692 22939532 20% /backup
/dev/mmcblk0p8 29941192 5756692 22939532 20% /etc/asound.conf
/dev/mmcblk0p8 29941192 5756692 22939532 20% /run/audio
tmpfs 784028 1116 782912 0% /run/dbus
/dev/mmcblk0p8 29941192 5756692 22939532 20% /etc/hosts
/dev/mmcblk0p8 29941192 5756692 22939532 20% /etc/hostname
/dev/mmcblk0p8 29941192 5756692 22939532 20% /etc/resolv.conf
tmpfs 1960060 0 1960060 0% /dev/shm
/dev/mmcblk0p8 29941192 5756692 22939532 20% /etc/pulse/client.conf
tmpfs 1960060 0 1960060 0% /proc/asound
devtmpfs 1926268 0 1926268 0% /proc/keys
devtmpfs 1926268 0 1926268 0% /proc/latency_stats
devtmpfs 1926268 0 1926268 0% /proc/timer_list
devtmpfs 1926268 0 1926268 0% /proc/sched_debug
tmpfs 1960060 0 1960060 0% /sys/firmware
➜ / du
... (shortened)
44 ./share
106224 ./backup
12 ./ssl
8 ./config/custom_components/fordpass/translations
48 ./config/custom_components/fordpass/__pycache__
128 ./config/custom_components/fordpass
16 ./config/custom_components/irrigation_unlimited/translations
80 ./config/custom_components/irrigation_unlimited/__pycache__
192 ./config/custom_components/irrigation_unlimited
100 ./config/custom_components/alexa_media/translations
168 ./config/custom_components/alexa_media/__pycache__
100 ./config/custom_components/alexa_media/.translations
628 ./config/custom_components/alexa_media
28 ./config/custom_components/average/__pycache__
64 ./config/custom_components/average
116 ./config/custom_components/sonoff/__pycache__
256 ./config/custom_components/sonoff
84 ./config/custom_components/hacs/helpers/functions/__pycache__
168 ./config/custom_components/hacs/helpers/functions
8 ./config/custom_components/hacs/helpers/__pycache__
20 ./config/custom_components/hacs/helpers/properties/__pycache__
40 ./config/custom_components/hacs/helpers/properties
44 ./config/custom_components/hacs/helpers/classes/__pycache__
88 ./config/custom_components/hacs/helpers/classes
20 ./config/custom_components/hacs/helpers/methods/__pycache__
44 ./config/custom_components/hacs/helpers/methods
356 ./config/custom_components/hacs/helpers
32 ./config/custom_components/hacs/operational/__pycache__
32 ./config/custom_components/hacs/operational/setup_actions/__pycache__
60 ./config/custom_components/hacs/operational/setup_actions
128 ./config/custom_components/hacs/operational
8 ./config/custom_components/hacs/translations
32 ./config/custom_components/hacs/hacsbase/__pycache__
68 ./config/custom_components/hacs/hacsbase
48 ./config/custom_components/hacs/__pycache__
12 ./config/custom_components/hacs/webresponses/__pycache__
24 ./config/custom_components/hacs/webresponses
20 ./config/custom_components/hacs/models/__pycache__
40 ./config/custom_components/hacs/models
32 ./config/custom_components/hacs/repositories/__pycache__
64 ./config/custom_components/hacs/repositories
48 ./config/custom_components/hacs/api/__pycache__
96 ./config/custom_components/hacs/api
12 ./config/custom_components/hacs/validate/__pycache__
8 ./config/custom_components/hacs/validate/integration/__pycache__
16 ./config/custom_components/hacs/validate/integration
20 ./config/custom_components/hacs/validate/common/__pycache__
40 ./config/custom_components/hacs/validate/common
84 ./config/custom_components/hacs/validate
964 ./config/custom_components/hacs
72 ./config/custom_components/scheduler/__pycache__
164 ./config/custom_components/scheduler
2400 ./config/custom_components
4 ./config/.cloud
12 ./config/blueprints/automation/homeassistant
16 ./config/blueprints/automation
20 ./config/blueprints
24 ./config/tts
4 ./config/deps
124 ./config/www/community/mini-graph-card
268 ./config/www/community/scheduler-card
52 ./config/www/community/lovelace-fold-entity-row
32 ./config/www/community/lovelace-multiple-entity-row
24 ./config/www/community/lovelace-tempometer-gauge-card
84 ./config/www/community/logbook-card
908 ./config/www/community
224 ./config/www/mando
1516 ./config/www
12 ./config/image/726a5828dd463dacf6621f13c543d85b
16 ./config/image
56 ./config/.storage/hacs
1992 ./config/.storage
487164 ./config
136 ./libexec
936290 .
I don’t understand why the total size of the filesystem is 936290 KB, but the used space is 5756692 KB.
tom_l
April 2, 2021, 10:25am
2
Your snapshots are taking up the most room. Do you have them automated?
No, they are not automated. In any case, now I only have two snapshots, with a total size of about 100 MB, while the space used of the disk is 5.5 GB.
➜ ~ cd backup
➜ backup ll
total 104M
-rw-r--r-- 1 root root 47.9M Apr 2 11:38 28650ce2.tar
-rw-r--r-- 1 root root 55.8M Mar 31 11:12 f699109c.tar
➜ backup du
106224 .
BTW, I’m using Home Assistant in a RP4 with a microSD card with 32GB.
tom_l
April 2, 2021, 10:36am
4
Could be something outside the Home Assistant container. What addons do you have installed?
I have these addons:
Duck DNS
File Editor
SQLite Web
SSH & Web Terminal
Samba Share
I also have these HACS integrations:
HACS
Sonoff LAN
Irrigation Unlimited
Scheduler component
fordpass
Average Sensor
Alexa Media Player
HACS frontend:
fold-entry-row
Tempometer Gauge Card
Scheduler Card
mini-graph-card
Multiple Entity Row
Logbook Card
Shaad
(David)
April 2, 2021, 11:29am
6
2 usefull links I use from time to time
HASSIO Docker Overlay2 folder consuming all disk space - Home Assistant OS - Home Assistant Community (home-assistant.io)
[Solved] Moved over to docker, all well except huge memory leak - Configuration - Home Assistant Community (home-assistant.io)
The ‘prune’ docker command seems to clean some old stuff not automatically cleaned when new versions are installed, especially for some community addons.
But : TAKE CARE to what you are doing ! Always backup before…
I’ve tried what suggested in the firs link.
I don’t have a journalctl
command in my system
This is the result:
➜ ~ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
homeassistant/armv7-hassio-cli 2021.03.1 1a4668350f99 3 days ago 72.3MB
ghcr.io/hassio-addons/ssh/armv7 8.1.0 0039c7f2369f 8 days ago 308MB
homeassistant/armv7-hassio-supervisor 2021.03.6 990618a1d04e 2 weeks ago 250MB
homeassistant/armv7-hassio-supervisor latest 990618a1d04e 2 weeks ago 250MB
homeassistant/raspberrypi4-homeassistant 2021.3.4 c86300c573cd 2 weeks ago 1.03GB
homeassistant/armv7-addon-samba 9.3.1 946d4c8915db 5 weeks ago 98MB
ghcr.io/hassio-addons/sqlite-web/armv7 3.0.1 1b49772aa200 5 weeks ago 88.6MB
homeassistant/armv7-hassio-audio 2021.02.1 40f28e0fd362 6 weeks ago 90.5MB
homeassistant/armv7-addon-duckdns 1.12.5 9e8282c0ea0a 7 weeks ago 71.9MB
homeassistant/armv7-hassio-dns 2021.01.0 eeb0a3e43eb4 2 months ago 85.9MB
homeassistant/armv7-addon-configurator 5.2.0 e197f4a5c640 4 months ago 130MB
homeassistant/armv7-hassio-observer 2020.10.1 bf193dc8f2c4 5 months ago 71.8MB
homeassistant/armv7-hassio-multicast 3 0fbd536e8547 7 months ago 63.3MB
➜ ~ docker image prune -a
WARNING! This will remove all images without at least one container associated to them.
Are you sure you want to continue? [y/N] y
Deleted Images:
untagged: homeassistant/armv7-hassio-supervisor:2021.03.6
Total reclaimed space: 0B
➜ ~ docker container prune --filter "until=24h"
WARNING! This will remove all stopped containers.
Are you sure you want to continue? [y/N] y
Total reclaimed space: 0B
➜ ~ docker volume prune
WARNING! This will remove all local volumes not used by at least one container.
Are you sure you want to continue? [y/N] y
Total reclaimed space: 0B
➜ ~ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
homeassistant/armv7-hassio-cli 2021.03.1 1a4668350f99 3 days ago 72.3MB
ghcr.io/hassio-addons/ssh/armv7 8.1.0 0039c7f2369f 8 days ago 308MB
homeassistant/armv7-hassio-supervisor latest 990618a1d04e 2 weeks ago 250MB
homeassistant/raspberrypi4-homeassistant 2021.3.4 c86300c573cd 2 weeks ago 1.03GB
homeassistant/armv7-addon-samba 9.3.1 946d4c8915db 5 weeks ago 98MB
ghcr.io/hassio-addons/sqlite-web/armv7 3.0.1 1b49772aa200 5 weeks ago 88.6MB
homeassistant/armv7-hassio-audio 2021.02.1 40f28e0fd362 6 weeks ago 90.5MB
homeassistant/armv7-addon-duckdns 1.12.5 9e8282c0ea0a 7 weeks ago 71.9MB
homeassistant/armv7-hassio-dns 2021.01.0 eeb0a3e43eb4 2 months ago 85.9MB
homeassistant/armv7-addon-configurator 5.2.0 e197f4a5c640 4 months ago 130MB
homeassistant/armv7-hassio-observer 2020.10.1 bf193dc8f2c4 5 months ago 71.8MB
homeassistant/armv7-hassio-multicast 3 0fbd536e8547 7 months ago 63.3MB
➜ ~ journalctl --disk-usage
zsh: command not found: journalctl
➜ ~ df
Filesystem 1K-blocks Used Available Use% Mounted on
overlay 29941192 5806516 22889708 20% /
tmpfs 1960060 0 1960060 0% /sys/fs/cgroup
/dev/root 98816 98816 0 100% /sbin/docker-init
/dev/mmcblk0p8 29941192 5806516 22889708 20% /share
/dev/mmcblk0p8 29941192 5806516 22889708 20% /data
/dev/mmcblk0p8 29941192 5806516 22889708 20% /media
/dev/mmcblk0p8 29941192 5806516 22889708 20% /addons
/dev/mmcblk0p8 29941192 5806516 22889708 20% /backup
devtmpfs 1926268 0 1926268 0% /dev
tmpfs 1960060 0 1960060 0% /dev/shm
/dev/mmcblk0p8 29941192 5806516 22889708 20% /ssl
/dev/mmcblk0p8 29941192 5806516 22889708 20% /config
tmpfs 784028 1120 782908 0% /run/dbus
tmpfs 784028 1120 782908 0% /run/docker.sock
/dev/mmcblk0p8 29941192 5806516 22889708 20% /etc/asound.conf
/dev/mmcblk0p8 29941192 5806516 22889708 20% /run/audio
/dev/mmcblk0p8 29941192 5806516 22889708 20% /etc/hosts
/dev/mmcblk0p8 29941192 5806516 22889708 20% /etc/hostname
/dev/mmcblk0p8 29941192 5806516 22889708 20% /etc/resolv.conf
tmpfs 1960060 0 1960060 0% /dev/shm
/dev/mmcblk0p8 29941192 5806516 22889708 20% /etc/pulse/client.conf
tmpfs 1960060 0 1960060 0% /proc/asound
devtmpfs 1926268 0 1926268 0% /proc/keys
devtmpfs 1926268 0 1926268 0% /proc/latency_stats
devtmpfs 1926268 0 1926268 0% /proc/timer_list
devtmpfs 1926268 0 1926268 0% /proc/sched_debug
tmpfs 1960060 0 1960060 0% /sys/firmware
Almost the same space used (I have made a snapshot of the system before running the suggested commands).
ruzickav
(Vladimir)
September 20, 2021, 12:35pm
8
Have you solved it? I have exactly same experience / issue. Can’t find solution or reason for this…
The ammount of space used depends over all of the numer of sensors you use and the period of time you record your sensor data. Those data are stored in the file home-assistant_v2.db
in your config folder.
Look at the recorder documentation: Recorder - Home Assistant
The most important parameters regarding space are: purge_keep_days
and commit_interval
.
You can also use exclude
to avoid recording some sensor data you won’t need.
To watch which sensors are generating more data, you can use the SQLite Web
addon. After installing, open web UI, and there click on events (on the left column) and then on Query. From there you can place any query to your database:
For instance:
SELECT "entity_id", COUNT("state") as "StateCount" FROM states GROUP BY "entity_id" ORDER BY "StateCount" DESC
Gives you the sensors ordered by numer of entries in the database.
SELECT "entity_id", COUNT("state") as "StateCount" FROM states WHERE "last_updated" >= '2021-09-19 00:00:00.000000' GROUP BY "entity_id" ORDER BY "StateCount" DESC
Gives you the same but since some momment in the past.
Hope this helps.
ruzickav
(Vladimir)
September 20, 2021, 6:00pm
10
Thank you. But it’s not my case. I am missing about 30GB and the home-assistant_v2.db is about 2,5GB.
francisp
(Francis)
September 20, 2021, 6:14pm
11
Camera recordings ?
Docker overlay2 ?
ruzickav
(Vladimir)
September 20, 2021, 6:26pm
12
All of those would be visible in “du -d 1 -h” , but I see 13,5GB used. “df -h” says 42GB used… no idea what to do…
overlay2 doesnt exists
camera recordings - probably not, but where to look?