HTPC with strange HDD activity while having no activity :)

Hello guys,

So I setup this fanless HDPlex H5 HTPC with an M2.SSD for the XUbuntu OS and a raid1 with 2x WD Green EARS 2TB HDDs.
It’s a dualhead system, on VT7 I’m running only Kodi and it’s the focus VT when the system boots up. On VT10 I have an XFCE for needy times.
I’ve set up hdparm to put the HDDs to sleep after 20minutes of inactivity. And this happens if I boot the system up and wait for 20minutes without using the media on the raid. But if I wake up the HDDs from watching a movie, the HDDs are not going to sleep ever since that point, and they start to “grind” just like they sound when you are copying huge amounts of data. And they are not stoping regardless of how many hours of inactivity I wait.
I’ve checked with iotop, dstat, mdadm -D, and there is NO ACTIVITY, no READ, no WRITE, but the hdds keep on “grinding” randomly. But there’s more, if I issue a “hdparm -Y /dev/sda” and “hdparm -Y /dev/sdb”, the HDDs are going to sleep and they stay that way, and the grinding dissapears.

So, this just happens in kodi. If I boot the system up and switch to XFCE, access the HDDs, see media, then stop any activity, then the HDDs are going to sleep after 20mins of inactivity. So this points me to kodi.

I’m looking for ways to debug this issue. I know it’s not OK for some ppl to put software mdadm raid HDDs to sleep, but that’s not the point of the issue.

Any help is apreciated. Thank you.