Over the past months, I had 2 external HDDs forming a RAID 1 (managed via mdadm) attached to my Raspberry Pi and until 2 days ago was under the impression that the HDDs are spun down most of the time, only rotating when they are in use and shortly afterwards.

One of the external HDDs can be influenced on its spin-down timeout via its device settings, the other one can't.

The last 2 days, almost all the time one of the HDDs (not always the same one) is spun up. I suspect that somehow reads happen which is weird because after I killed the owncloud client I was using, nothing should be using the RAID if I don't access it via SSH.

iotop provides my with the names of a whole bunch of processes but to me it looks like those are system processes which merely operate on the SD card. But because there are so many, I might very well overlook the important entry / entries. I want to ignore all those which mere access the SD card so I can focus on those which access the RAID.

How can I find out what process is accessing the RAID (/dev/md1) or my HDDs (/dev/sda and /dev/sdb)?


lsof will provide you a list of all open files, from which you should probably be able to find out the process accessing that filesystem.

Also, I would take a look at the defined crontabs, as the root cause could easily be some process performing a scheduled scan on the whole directory hierarchy.

  • I don't think open files are important for whether a HDD spins down. There currently are no open files. I'd somehow have to catch the process name of an open file entry for the very short period of time it might exist and I don't know how to do this.
    – UTF-8
    Nov 28 '17 at 20:10
  • @UTF-8, As "something" is using the device, I expected that either a process would be working with a single file / few files (which would be detected easily), or with many files, so that catching any of them would be likely. If we have a process shortly reading/writing a file and then sleeping for a long time, it'll be quite harder to catch them. Maybe worth enabling the Linux audit subsystem, in that case.
    – Ángel
    Nov 28 '17 at 22:01
  • I just found out that lsof only lists open files located immediately in the current directory. Yesterday, I assumed it do list any open files further down the directory tree. This would probably be a lot more useful. Does the command support this?
    – UTF-8
    Nov 29 '17 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.