I have similar issue. I have SSD,
/dev/sdb, with OS (Linux Mint 18.1 based on Ubuntu Xenial) and HDD,
/dev/sda, with data, which I use time to time. Both disks are encrypted. HDD's partitions are not mounted. And anyway in periods of several minutes HDD wakes up, then sleeps, then wakes up again. Mess.
Here is a duplicate question with helpful answer, which suggests
auditd to find the bad-behaving process.
apt-get install auditd
auditctl -w /dev/sda -p rwa
Then I force HDD to sleep with
hdparm -Y /dev/sda. Then wait until I hear HDD spinning up again. Then run
ausearch -f /dev/sda. In my case it shows entries like the following.
time->Sat Feb 25 12:38:17 2017
type=PROCTITLE msg=audit(1488022697.651:1744): proctitle=2F7573722F6C69622F756469736B73322F756469736B7364002D2D6E6F2D6465627567
type=PATH msg=audit(1488022697.651:1744): item=0 name="/dev/sda" inode=376 dev=00:06 mode=060660 ouid=0 ogid=6 rdev=08:00 nametype=NORMAL
type=CWD msg=audit(1488022697.651:1744): cwd="/"
type=SYSCALL msg=audit(1488022697.651:1744): arch=c000003e syscall=2 success=yes exit=12 a0=f3fb90 a1=800 a2=7f4745221f64 a3=30 items=1 ppid=1 pid=18520 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="pool" exe="/usr/lib/udisks2/udisksd" key=(null)
Relevant part is exe="/usr/lib/udisks2/udisksd". Though I also had
smartd was also the culprit. I uninstalled
smartmontools and stopped
udisk2 service with
service udisks2 stop. After that HDD sleeps as expected.
udisks2 will automatically start when I, for instance, open Disks application, so I have to stop it again. Another downside is that SMART parameters are not monitored for both disk, which is not good but as a workaround it fits.
Also one thing that is not clear, is that this bug report says
udisks2 doesn't do polling disks which is now done by kernel. But the evidence seems to indicate the contrary.