3

I have in my Arch Linux-running laptop an SSD and an HDD; the latter I use seldom. It is mounted as /mnt/sdb5 and configured to spin down proactively when on battery (/etc/default/tlp, DISK_APM_LEVEL_ON_BAT has the value 1 for sdb).

However, the disk spins up in two situations which I would rather it didn’t:

  • When I suspend the machine, it spins up and them promptly down again. I can’t for the life of me imagine why it would do this when I haven’t even touched the drive since it was mounted.

  • When I wake the machine, it spins up. Perhaps it is making sure it’s there or some such thing?

(It also spins up at boot time, but that I understand. Of course it must read the partition table.)

Can I avoid these spin-ups without removing the hard disk drive? I’m quite willing to only mount it when I want to use it or such things.

1

Most drive manufactures use a jumper setting to enable the device to manage its own power. On Green Western Digital drives, for example, jumper pins 3&4 (2nd row from the right when looking at the jumper block from the rear of the drive). Once this is accomplished, the drive will never spin unless commanded. This allows a RAID or vault controller to start the drives sequentially or as needed.

The following sugggests some approaches not Arch specific. Your mileage may vary.

With the drives jumpered, you will need to trigger starts when mounting. During boot, this is done with a script in /etc/init.d or a "start on starting mountall" triggered script depending on your system's init(8). This is not an issue if you never mount until needed.

once they are detected udev(8) or other daemon may magically start sleeping disks necessitating modification of the daemon's rules.

It may be necessary to create /sbin/mount. scrips to intercept mount commands and get the disk ready before using the original mount program for the FS type. For example, move /sbin/mount.cifs to some place like /usr/lib/mount/ and call it from a script (or program) you put in /sbin/mount.cifs that initially powers the drive and possibly waits for it to be ready.

umount(8) as above to put drives to sleep.

udev(8) will emit a "device off/online" event you might want to handle/use when the device changes state.

Once your devices are spinning only when desired, you might look at automount(8) or afuse(8) for automatic management. That way, whenever you reference a file on a sleeping drive, it will spin, mount and return the data transparently -- though with some delay. When idle for a while, it will umount(8) and spin down.

| improve this answer | |
  • I've only ever seen jumpers on 3.5" drives... are they on 2.5" drives too and I've just missed it? – Michael Jul 7 '18 at 16:49
  • ok I just checked an there are 4 jumper pins on a 2.5" drive, but on a WDC mobile drive the only options appear to be a "reduced power spin-up" which makes it spin up slower to reduce peak current draw, and spread spectrum clocking. So... out of luck i guess? :'-( – Michael Jul 7 '18 at 17:21
0

To disable partition to be mounted at startup you need to edit /etc/fstab. To have your HDD not automounted when you boot, add one line for each partition, such as:

/dev/sdb5 / auto noauto 0 0

UPDATE:

sudo hdparm -y /dev/sdb

   -y     Force  an  IDE drive to immediately enter the low power consump‐
          tion standby mode, usually causing it to spin down.  The current
          power mode status can be checked using the -C option.

hdparm -S X? /dev/sb5 where X? is according to the description below, but as far as I can understand 1 will result in 5 seconds working and then "sleeping"

this is from man hdparm

   -S     Put the drive into idle  (low-power)  mode,  and  also  set  the
          standby (spindown) timeout for the drive.  This timeout value is
          used by the drive to determine how long to wait  (with  no  disk
          activity)  before  turning  off the spindle motor to save power.
          Under such circumstances, the drive may take as long as 30  sec‐
          onds  to respond to a subsequent disk access, though most drives
          are much quicker.  The encoding of the timeout value is somewhat
          peculiar.   A  value  of zero means "timeouts are disabled": the
          device will not automatically enter standby mode.  Values from 1
          to  240 specify multiples of 5 seconds, yielding timeouts from 5
          seconds to 20 minutes.  Values from 241 to 251 specify from 1 to
          11 units of 30 minutes, yielding timeouts from 30 minutes to 5.5
          hours.  A value of 252 signifies a  timeout  of  21  minutes.  A
          value  of 253 sets a vendor-defined timeout period between 8 and
          12 hours, and the value 254 is reserved.  255 is interpreted  as
          21  minutes  plus  15  seconds.  Note that some older drives may
          have very different interpretations of these values.

if it helps it can be added to /etc/hdparm which is a bit different.

| improve this answer | |
  • I’ve now checked, and having the volume unmounted in this way does not stop the hard disk drive from spinning up on startup, sleep or wakeup. Therefore, sorry, but this doesn’t answer the question. – Chris Morgan Jul 18 '14 at 7:33
  • It's all right, good that you checked, now we know and think about what else can be there. – Ruslan Gerasimov Jul 18 '14 at 8:12
  • Spinning the drive down never stops it from spinning up. It just makes it spin down again after that. – Chris Morgan Jul 20 '14 at 7:18
  • sudo hdparm -y /dev/sdb didn't help? – Ruslan Gerasimov Jul 20 '14 at 7:27
  • That is correct. – Chris Morgan Jul 20 '14 at 7:28

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.