Diagnosing Large Writes to Disk

I have home assistant installed on an RPi 4. I recently switched my installation from an SD card to an SSD. I’ve been monitoring the SDD stats by accessing its SMART values, and I was blown away to see that home assistant is writing ~100gb to disk every 24h.

It’s a wonder that my SD card lasted as long as it did.

This isn’t normal, right? How would I go about figuring out what exactly is causing this?

I found this promising post on how to minimise disk writes, but I’m not sure how to run the diagnostic commands at the end of the post. E.g. sudo iotop -aod 2 doesn’t run on the host system because the package iotop is not present. And, unless I’m mistaken, running it inside the Terminal addon only seems to show the writes inside that specific docker container?

You don’t say how you installed HA on the RPi. Is it Debian based, or did you use the Home Assistant Operating System? If the latter then I can’t help you.

You could try to install iotop following these instructions:
sudo apt-get install iotop -y
But note that in order to be able to install the package there are certain requirements on your installed kernel.

If you can’t connect to the RPi directly using a keyboard and micro HDMI connector or cable, then you could connect remotely using Putty or one of these methods.

It’s the Home Assistant Operating System unfortunately. I have SSH access to the host system, but yeah since the host system doesn’t have a package manager, I’m not sure what to do.

This 100gb/day is it just writes or incremental data amountg on the disk?
Are you using SQLite or any other database (Maria DB?). I’ve seen this amount of data (4~6 MB/s written to database on my system, though it was remote MariaDB on Synology NAS. It caused for me total SSD wear in just 11 months. It is wy better after swithing from Synology package to docker image with newer version and after recent optimization done for data handling in HA (it is now at 200~300KB/s, which is still 20~25gb daily).

MariaDB.

I actually updated from Home Assistant v2022.12.x to the latest version today, and it actually came up with a warning to update MariaDB due to some issues with the older version (v2.4.0) I was running? I did this update, and it looks like this update might have improved things quite a bit. I’m now getting ~750Mb per hour, which is ~18Gb per day, which feels a lot more reasonable.

Looking at the MariaDB changelogs, there doesn’t seem to by anything about a bugfix for an issue like this though. I’ve also been messing around with other Home Assistant stuff (maybe the update from v2022.12.x to the latest version was the thing that fixed it?), so if I discover something else I did actually fixed things, I will make another post.