Why is my HDD waking up?

Hi!
I just finished building my first nas with a Rock64 with emmc, one 3tb WD elements external hard drive, one 4tb WD red with the HD622 board.
The issue I'm having is that something wakes up my drives and I can't figure out what is it. I'm using a new installation of OMV from sourceforge with omv extras, flashmemory, shell in a box, docker (with no containers for now), smb and ssh running.
Changes in the "Physical disk properties" seem to have no effect (I tried setting spindown time to "disabled" but the disks are spinning down anyway). I'm guessing that the usb to sata controllers have spindown built in and it can't be changed in OMV. Anyway, I'm not really interessed in turning it off, I just want to know why the disks spin back up for no apparent reason.
I currently have S.M.A.R.T. enabled (check interval: 1800, power mode: standby). I tried disabling it but that didn't work. I tried with iosnoop but nothing came up.

Source Code

root@rock64:~# ./find_culprit.sh sdb

-bash: ./find_culprit.sh: /bin/sh^M: bad interpreter: No such file or directory

I'm new to Linux so I must be doing something wrong. What I did was: create the file "find_culprit.sh" with notepad++ on windows and move it to /root using filezilla, chmod 755 find_culprit.sh, ./find_culprit.sh sdb. Again, I don't know if this is the right way to do it but this is what I figure out and it took me a long time to do so because I'm a total noob .
I also found this thread where this user had the same issue I have and managed to track it down to "webmin". I have never heard of webmin and I am pretty sure I haven't installed it on my system.

I usually copy a script by the the small sign in the upper right corner of the "source code" box. Then paste it in a plain text file.

I have attached the file below for you. Please rename it (remove the .txt) and make it executable. It is not mandatory to have an .sh file extension it also should work without any. Create a different directory than / (which is root) for scripts e.g. "/scripts", copy the script to this folder and chdir to this folder: "chdir /scripts".

I can´t remember ever having problems with line feed characters. I am using WinSCP to connect to my OMV box. You could also try to create a new empty file directly at the target folder by WinSCP or any other tool which is suitable for unix files and then paste the content of the script directly to this file.

So first I'd try to disable everything on the page for "Physical disk properties".

If a HDD is spun down, then running a SMART test on it may spin it up. So disable any and all SMART tests. Or possibly set a long interval between tests. Like 24 hours.

Ok, so I disabled everything in "Physical disk properties", turned off SMART and rebooted. Then I run the find_culprit script and it looked like it was working.

Source Code

root@rock64:/scripts# ./find_culprit sda

Putting the disk sda into standby...

Checking the status of sda.

Drive is still in standby. Sleeping 45 seconds...

Drive is still in standby. Sleeping 45 seconds...

But when the disk woke up, the script didn't show any message, it kept saying "drive is still in standby". I then ran hdparm -C /dev/sda and it also reported the drive to be sleeping even if it actually was active.

Well, I was digging a little bit deeper into the system and disabled temporarily the services collectd and monit. But this wasn't the clue.
Then I read the great how to including test script in the following thread:
My Guide to Debugging Disk Spin-ups

So I have found, that "parted" was checking my devices over and over again. Unfortunately I was not able to discover which process was triggering parted. I've simply disabled the system tool via renaming it inside /sbin.

I'm still curious, what's behind this process. So if anybody has an idea I'd be glad to read it here..

I think the issue is gone. I renamed "parted", disabled smb and deleted the active rsync jobs and then the issue disappeared. I then undid each change one by one to find the culprit but the issue never came back. So now it's gone but I don't know what has caused it in the first place. I have the smb share mounted on my nvidia shield so it could have been that even though I'm pretty sure there wasn't any smb activity on iosnoop. Oh well at least it's gone. Thank you all for your time.

I need to test this more but I think SMART was causing the disk to spin up. Anyway, I need to change the default spindown time for the hd622 (which currently is 10 minutes) to something higher like 60 minutes. I tried hdparm and hd-idle but neither of them work. Can anyone suggest a solution (changing the hd622 for something else is also an accepted solution)?

As I know this tool is the successor of the older wdidle3 tool and it increases the timer on the WD RED from some seconds to 300s. That means the heads are no more moved to the parking position every some seconds but after 5 minutes.

You can query the actual head parking time of the WD REDs also with the wdidle3 tool.

For my opinion the head parking "feature" is independant from spindown. This means the heads are parked while the drive is still spinning. But I could also be wrong.

Yeah I've read about that. I tried idle3 to query the parking time but it doesn't work. I guess the hard drive must be attached to a sata controller and not a sata to usb adapter.
However, I've read that the low head parking time was only an issue on the early versions of the reds and greens and that WD are selling reds with 300 seconds head parking time from factory. I noticed that roughly 5 minutes after the disk wakes up, the disk makes a click noise. That might be the head parking noise. The disk continues spinning for another 5 minutes and then it goes to sleep.
I'm gonna give the WD utility a shot for confirmation after the backup is done.
I'm afraid that the spindown time is handled by the sata to usb adapter and it cannot be changed. Thus, I need to buy a different one. I'm also afraid I need to settle for a single sata port. Can you recommend me one?

Update: I've hooked up the hard drive to my desktop pc but unfortunately it can't be detected. I'm guessing it's because the pc is running windows and the drive is formated in ext4. I don't think it's worth wasting time trying to workaround this problem since I'm pretty sure this won't solve my issue which is raising the spindown time.

I've asked on the pine64 forum if their usb to sata works with hdparm but I've got no answer. @tkaiser I noticed you reviewed it, can you please tell me if hdparm works as intended with it?

I've asked on the pine64 forum if their usb to sata works with hdparm but I've got no answer. @tkaiser I noticed you reviewed it, can you please tell me if hdparm works as intended with it?

No idea since this always depends on the firmware of such USB-to-SATA bridges (see the spindown hassles ODROID HC1/HC2 have/had which also rely on JMS578). Maybe you need to flash a different firmware? But if I understand correctly your problem is your disks spinning up while they shouldn't (which is somewhat unrelated to hdparm issues like drives not going to sleep while they should)

But if I understand correctly your problem is your disks spinning up while they shouldn't

That was my initial problem but I think I figured that out. I think it was caused by SMART, not 100% sure though. My problem now is that the disk spins down after only 10min of inactivity and there seems to be no way of increasing that. I can settle for an adapter that doesn't work with hdparm but has a higher spindown time by default. Do you happen to know what is the factory spindown time for the pine64 adapter?

Ok, I hear you. I just realized that pine64 charges 12$ for shipping so their cable is not an option anymore . I think I'm going to try my luck on amazon and buy something with the jms578 chip. At worst I can return it.