3

I recently bought a CubieBoard 3 and installed Debian. The OS is installed on SD card and I use a 2.5" HDD to share files. The HDD is using ext4.

I want the HDD to spin down if it is not used to save energy and increase the disk's lifetime. I had some problems using hdparm so I tried hd-idle which seems to work.

The disk is spinning down for exactly 5 minutes and is then active for other 10 minutes just to repeat it again.

Any tips how I could analyze what is spinning my disk up?

minils
  • 163
  • 1
  • 16
  • Which filesystem? With ext3/ext4 (and maybe with others) there is a regular commit which wakes the disk. I don't know whether this can be disabled. Maybe autofs is an option for you. – Hauke Laging Jan 27 '15 at 10:25
  • I'm using ext4. And I need the disk to be mounted so it can be woke up by an access. – minils Jan 27 '15 at 10:42
  • 1
    [how to analyse io utilisation per process](http://serverfault.com/a/169679/192294) – 把友情留在无盐 Jan 27 '15 at 10:52
  • You don't know what autofs / automounter is, do you? – Hauke Laging Jan 27 '15 at 10:55
  • I read something on ubuntu wiki. But it seems like I didn't understand it. – minils Jan 27 '15 at 11:03
  • The automounter unmounts a volume when it has not been needed for a certain time and mounts it automatically when it is accessed. Except for the delay this is transparent to the accessing process. – Hauke Laging Jan 27 '15 at 11:06
  • But I still don't see the efford. It would still be mounted by "the process" that wakes it up at the moment or not? – minils Jan 27 '15 at 11:12
  • The automounter (or rather: the write access which takes place during mounting) would wake the drive. But as the drive would be unmounted most of the time there would not be any more filesystem commits waking it up. – Hauke Laging Jan 27 '15 at 13:01

2 Answers2

4

I am pretty sure Debian installs and runs smartd by default to keep an eye on your disks' SMART status. The regularity with which the disk is spinning up certainly points to something like that.

First, run /etc/init.d/smartd status to check whether smartd is running. If it is, that might be it. If not, it's something else, and you can disregard this answer.

Second, check /etc/smartd.conf and /etc/defaults/smartmontools. The best way to have a normally-powered-down disk in a smartd configuration is to list it manually in /etc/smartd.conf but with a -n switch given. For example:

/dev/disk/by-id/wwn-0xXXXXXXXXXXXXXXXX -a -l error -l selftest -n standby,10,q -m root@localhost

The -n (or --nocheck) is described in the smartd(8) and smartctl(8) man pages. standby here specifies don't check the drive (which may spin it up) if the drive is in standby mode (spun down), and ,q means don't write an informational log message saying that the check was skipped (which itself may cause the drive to spin up). You can also add ,N to this where N is an integer specifying the maximum number of consecutive checks to skip. In the example above, after ten checks are skipped the drive will be checked anyway, regardless of its current power state.

user
  • 28,161
  • 13
  • 75
  • 138
  • Thanks for your answer but this is the result I get `/etc/init.d/smartd: No such file or directory` – minils Jan 27 '15 at 11:01
  • Reading the SMART status should not cause a drive to spin up, just runnung SMART tests should. 5 minutes seems to me a bit short for that. – Hauke Laging Jan 27 '15 at 11:04
  • I used iotop to figure out what was spinning up my drives periodically.. And yes it was smartd – mafrosis Jul 12 '16 at 18:08
1

Thanks for your help but I was creating the issue myself.

Although it's a stupid thing, I want to share it: I have an ownCloud installation which is installed on the SD card as well. It is necessary to run a cronjob which is writing a lock file to the disk every 15 minutes which was waking my disk up.

minils
  • 163
  • 1
  • 16