Automatic Spindown of WD HDD

I have this drive:


/dev/sdb1:

ATA device, with non-removable media
        Model Number:       WDC WD5000AAKX-083CA1
        Serial Number:      WD-WMAYUC881503
        Firmware Revision:  19.01H19
        Transport:          Serial, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0
Standards:
        Supported: 8 7 6 5
        Likely used: 8
Configuration:
        Logical         max     current
        cylinders       16383   16383
        heads           16      16
        sectors/track   63      63
        --
        CHS current addressable sectors:   16514064
        LBA    user addressable sectors:  268435455
        LBA48  user addressable sectors:  976773168
        Logical/Physical Sector size:           512 bytes
        device size with M = 1024*1024:      476940 MBytes
        device size with M = 1000*1000:      500107 MBytes (500 GB)
        cache/buffer size  = 16384 KBytes
        Nominal Media Rotation Rate: 7200
Capabilities:
        LBA, IORDY(can be disabled)
        Queue depth: 32
        Standby timer values: spec'd by Standard, with device specific minimum
        R/W multiple sector transfer: Max = 16  Current = 0
        DMA: *mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5
             Cycle time: min=120ns recommended=120ns
        PIO: pio0 pio1 pio2 pio3 pio4
             Cycle time: no flow control=120ns  IORDY flow control=120ns
Commands/features:
        Enabled Supported:
           *    SMART feature set
                Security Mode feature set
           *    Power Management feature set
           *    Write cache
           *    Look-ahead
           *    Host Protected Area feature set
           *    WRITE_BUFFER command
           *    READ_BUFFER command
           *    DOWNLOAD_MICROCODE
                SET_MAX security extension
           *    48-bit Address feature set
           *    Device Configuration Overlay feature set
           *    Mandatory FLUSH_CACHE
           *    FLUSH_CACHE_EXT
           *    SMART error logging
           *    SMART self-test
           *    General Purpose Logging feature set
           *    64-bit World wide name
           *    WRITE_UNCORRECTABLE_EXT command
           *    {READ,WRITE}_DMA_EXT_GPL commands
           *    Segmented DOWNLOAD_MICROCODE
           *    Gen1 signaling speed (1.5Gb/s)
           *    Gen2 signaling speed (3.0Gb/s)
           *    Gen3 signaling speed (6.0Gb/s)
           *    Native Command Queueing (NCQ)
           *    Phy event counters
           *    NCQ priority information
                DMA Setup Auto-Activate optimization
           *    Software settings preservation
           *    SMART Command Transport (SCT) feature set
           *    SCT Read/Write Long (AC1), obsolete
           *    SCT Write Same (AC2)
           *    SCT Features Control (AC4)
           *    SCT Data Tables (AC5)
                unknown 206[12] (vendor specific)
                unknown 206[13] (vendor specific)
Security:
        Master password revision code = 65534
                supported
        not     enabled
        not     locked
        not     frozen
        not     expired: security count
                supported: enhanced erase
        88min for SECURITY ERASE UNIT. 88min for ENHANCED SECURITY ERASE UNIT.
Logical Unit WWN Device Identifier: 50014ee0031b0d10
        NAA             : 5
        IEEE OUI        : 0014ee
        Unique ID       : 0031b0d10
Checksum: correct

I was able to successfully integrate into my turris as an USB attached network drive with an ext4 formatting. The one thing I cannot solve is its spin-down behavior. It won’t spin-down at all.

After consulting the OpenWrt wiki I tried all the options as described here. The disk reacts to a manual spin-down via the hdparm command. But it won’t allow me to configure its standby timer which is disabled as far as I understand it from the above information.

hd-idle shows no reaction at all. For sdparm there apparently seems to be no install package.

As a cursory search shows, WD blues and other seem to have this problem in general.

Any pro tips or solutions for this?

Why you dont use LUCI for it?
Services - hd-idle and look also at System-startup that hd-idle is enabled.

hd-idle is enabled and I tried it over the LUCI interface. I also tried via SSH. As I stated above, the HDD does not listen to the spin-down command of hd-idle.

I have a seagate external drive in my ubuntu NUC that also doesn’t listen to spindown commands.
I’ve fixed it by adding to rc.local:
/sbin/hdparm -S 120 /dev/sdb

man for “-S” parameter states:
-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 seconds 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.

When I try to apply it via SSH I get this:

 /dev/sdc1:
     setting standby to 1 (5 seconds)
    SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

With this it wouldn’t work via the local startup file either?! Or would it?

Try to apply it to the whole drive sdc, not the partition.

Ok.

root@turris:~# hdparm -S 1 /dev/sdc

/dev/sdc:
 setting standby to 1 (5 seconds)
SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Same.

try higher values like 120
you can search for a better alternative here:
http://www.nslu2-linux.org/wiki/FAQ/SpinDownUSBHarddisks

1 Like

Yes. :slight_smile:

root@turris:~# hdparm -S 120 /dev/sdc

/dev/sdc:
 setting standby to 120 (10 minutes)
SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
root@turris:~# hdparm -S 130 /dev/sdc

/dev/sdc:
 setting standby to 130 (10 minutes + 50 seconds)
SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
root@turris:~# hdparm -S 140 /dev/sdc

/dev/sdc:
 setting standby to 140 (11 minutes + 40 seconds)
SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
root@turris:~# hdparm -S 150 /dev/sdc

/dev/sdc:
 setting standby to 150 (12 minutes + 30 seconds)
SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
root@turris:~# hdparm -S 160 /dev/sdc

/dev/sdc:
 setting standby to 160 (13 minutes + 20 seconds)
SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
root@turris:~# hdparm -S 200 /dev/sdc

/dev/sdc:
 setting standby to 200 (16 minutes + 40 seconds)
SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
root@turris:~# hdparm -S 250 /dev/sdc

/dev/sdc:
 setting standby to 250 (5 hours)
SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
root@turris:~# hdparm -S 260 /dev/sdc
  -S: bad/missing standby-interval value (0..255)
root@turris:~# hdparm -S 255 /dev/sdc

/dev/sdc:
 setting standby to 255 (21 minutes + 15 seconds)
SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
root@turris:~# hdparm -S 300 /dev/sdc
  -S: bad/missing standby-interval value (0..255)

All the same.

Uhh, thanks. I am looking into it.

A lot of information. Much seems old or system specific in terms of availability of software and a tad bit complicated… I keep looking.

Further suggestions are welcome.

Does the hard drive support APM?
hdparm -B /dev/sdb
My WD Blue Mobile spins down only if APM level is 0-127.

root@turris:~# hdparm -B /dev/sdc

/dev/sdc:
 APM_level      = not supported

:frowning: Is this normal? Why wouldn’t a drive support it…

My thinking, how can I modify the Current value 0 to anything else? Shouldn’t modifying it do something? Or more so, shouldn’t this be modifiable?

The drive listens to a manual spin-down command with hdparm:

root@turris:~# hdparm -y /dev/sdd

/dev/sdd:
 issuing standby command

Wouldn’t any kind of automatic script do the trick that issues this commanmd after X time has passed? I am not versed in any kind of scripting language. Anyone any idea?

if you know that won’t use the disk during the night you can add it to a cron.
https://wiki.openwrt.org/doc/howto/cron
if you issue this too often like once a minute during the day when you use it you risk damaging the disk

1 Like

Thanks for pointing that out. This might be a solution until anything better comes along. Thanks.

Of course. Why’d you think I torture my HDD like that?! :astonished: :wink: But seriously, you mean even when it is spun down already? HDD is not spinning and receives the command, that would damage it over time?

not sure if it hurts to issue the command when it’s spin down already

I was thinking to set-up cron to issue the command every 6 hours or so. Why would it hurt the drive when it is in standby and it receives the command? What makes you unsure?

i;m unsure because i didn’t test it :slight_smile:
but that’s your job - test it and make sure the drive is not spinning on-off during the command reissuing

1 Like