Something unknown reads data from my disks
I’ve got a small server at home to access my files and the HDDs don’t spin down. Currently it runs Ubuntu Server 22.04. Executing something like $ cat /sys/block/sde/stat
displays some information including the total sectors read. If I wait for about 20 minutes and execute this command again, the total amount of sectors read increased.
$ cat /sys/block/sde/stat
6886729 970027822 7822380784 1292509782 15759 276608 2297706 485868 0 30475568 1293440472 0 0 0 0 23680 444820
... Wait about 20 minutes
$ cat /sys/block/sde/stat
6886734 970027822 7822380787 1292510398 15759 276608 2297706 485868 0 30476188 1293441088 0 0 0 0 23680 444820
But in theory there shouldn’t be any process accessing this HDD.
This all started 2 days ago after upgrading to Ubuntu Server 22.04 from Ubuntu Server 20.04.
I already tried to use <inside the correct directory>$ sudo fatrace -c
, but this didn’t show anything. Also I tried to use $ inotifywait -m -r /...
, still nothing.
How am I able to dig deeper so my HDDs are finally able to spin down again?
Using iotop
You can monitor disk IO with iotop
.
Install with:
sudo apt install iotop
And run:
iotop
This should tell you exactly which processes use disk and swap.
Using htop
You can also monitor IO directly with htop
(although it’s a sort of "hidden" feature).
Install with:
sudo apt install iotop
And run:
htop
Now press Tab to switch to the IO screen (instead of the main screen). This gives info similar to iotop
.
Using udisksctl
If you suspect the activity is related to udisks
, you can try and run:
udisksctl monitor
This will tell you if there is activity with the udisks
daemon.
I solved it.
With sudo dstat -tdD /dev/xxx --top-io
I was able to see which services did something with my drive. Those were in my case:
- smartd
- irqbalance
- udisks2
So I had to do
sudo systemctl stop udisks2.service # System still works, seems not to be so important
sudo systemctl disable udisks2.service
sudo systemctl stop smartd.service # SMART is nice, but not if the daemon prevents the drive from going into standby
sudo systemctl disable smartd.service
sudo systemctl stop irqbalance.service # If you got a server with hunders of drives this is meaningful for performance. In my case just overkill and prevents my drives from sleeping
sudo systemctl disable irqbalance.service
Thanks to Artur Meinlid for the assistance.
Edit: At least I thought it was solved. I realized that udisks2.service
restarts after some hours. The service is stopped and disabled but it still restarts. What the potatosalad?
Edit2: It was possible to mask this service.
sudo systemctl mask udisks2.service
sudo systemctl stop udisks2.service
Now this service doens’t get restarted and the HDDs are sleeping. I tested this for a week now and everything works fine.