Let the USB disk sleep

I attached a USB drive to my WdMyCloud.

Even with the WdMyCloud Energy Saver switched on, the USB disk kept spinning 24 hours a day.

The solution hereunder works for my USB drive. It spins down after 15 to 20 minutes.

Required tools:

SSH switched on (via the http://wdmycloud interface).

Putty or FileZilla or any SSH/SFTP client.

Add the following at end of /etc/hdparm.conf:

/dev/sdb {
    spindown_time = 180
    apm = 127
}

Reboot the WdMyCloud device, via the http://wdmycloud UI.

If you want to know more, search the web for information about hdparm.

/dev/sdb is the USB disk name. It seems that the WdMyCloud always uses that name for the (first) USB disk.

The ‘apm’ stands for Advanced Power Management.

Note:

I also have disabled ‘streaming’ (via the http UI).

If you want to keep ‘streaming’, then you can modify the content scanning frequency.

See http://community.wd.com/t5/WD-My-Cloud/How-to-spin-down-your-HDD/td-p/625261/page/2.

Let’s hope that WD will include that in the next firmware update.

1 Like

Hmm
 I tried that (with the reboot and things) and it doesn’t have any effect on Iomega 2TB USB disk. Any suggestion?

=======================================

=======================================

=== 1. Check your drives capability and status.

=======================================

=======================================

========================

= 1.1. APM

========================

For displaying the Advanced Power Management (APM) status of your drives:

hdparm -B /dev/sd?

WDMyCloud:~# hdparm -B /dev/sd?

/dev/sda:
 APM_level = not supported

/dev/sdb:
 APM_level = 127

/dev/sda is the WdMyCloud internal drive. In this case, it does not support APM.

/dev/sdb is the first USB drive. In this case, the APM is set to 127 (via /etc/hdparm.conf).

========================

= 1.2. Standby spin-down

========================

For displaying the spin-down capability of the /dev/sdb drive:

hdparm -I /dev/sdb

WDMyCloud:~# hdparm -I /dev/sdb
/dev/sdb:

[many lines]

Capabilities: ...
        Standby timer values: spec'd by Standard, no device specific minimum[many lines]

In this case, the /dev/sdb drive supports standby (spindown).

=======================================

=======================================

=== 2. Try it out

=======================================

=======================================

You can try it manually with the command hdparm.

When the WdMyCloud will reboot, it will forget everything you did with hdparm.

(The WdMyCloud applies the /etc/hdparm.conf settings when booting.)

Display hdparm help:

WDMyCloud:~# hdparmhdparm - get/set hard disk parameters - version v9.39, by Mark Lord....
-B Set Advanced Power Management setting (1-255)
...
-S Set standby (spindown) timeout
...

Try it out:

WDMyCloud:~# hdparm -B 126 /dev/sdb

/dev/sdb:
 setting Advanced Power Management level to 0x7e (126)
 APM_level = 126

The disk will go ‘power management’ after 126 x 5 seconds of inactivity.

Max value for spin-down = 127.

Try the other one:

WDMyCloud:~# hdparm -S 179 /dev/sdb

/dev/sdb:
 setting standby to 179 (14 minutes + 55 seconds)

 The disk will spin-down after 179 x 5 seconds of inactivity.

Your disk must support at least one:

   either -B (APM),

   either -S (spindown).

Notes about hdparm:

 -y   Put drive in standby mode

 -C   Check drive power mode status

=======================================

=======================================

=== 3. Inactivity

=======================================

=======================================

Finally, you must make sure that the USB drive actually remains unrequested.

Nothing should read or write that disk for a while.

Here are my settings in the http://wdmycloud interface:

cloud access off

energy saver on

mac backups off

streaming off

itunes off

With hdparm.conf set and all those services enabled, my USB drive spun down for short times, but it was frequently woken up.

Turning the services off made the difference.

1 Like

If your /etc/cron.hourly contains a task that accesses the USB drive, you should consider moving that task to /etc/cron.daily.

In my case, there never was anything in /etc/cron.hourly.

Check /etc/crontab.

Mine contains this line:

17 *    * * *    root    cd / && run-parts --report /etc/cron.hourly

It runs the content of /etc/cron.hourly at every hour and 17 minutes.

I played around with hdparm. My disk doesn’t support APM but it does support standby.

When I issue commands to the disk though I don’t they are effective. I get a

/dev/sdb:
 issuing sleep command
SG_IO: bad/missing sense data, sb:  70 00 02 00 00 00 00 0a 00 00 00 00 3a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

for example.

Also

ZPCloud:~# hdparm -C /dev/sdb

/dev/sdb:
SG_IO: bad/missing sense data, sb:  70 00 02 00 00 00 00 0a 00 00 00 00 3a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 drive state is:  standby

But the disk is spinning


It seems that your disk does not support “hdparm -S”.

When you do “hdparm -I /dev/sdb”, do you get a line like “Standby timer”?

Capabilities: ...
        Standby timer values: spec'd by Standard, no device specific minimum

If you do, what is the line?

Weird, yesterday I was entering


hdparm -I /dev/sdb

and I was getting plenty of lines including one like yours


Standby timer values: spec’d by Standard, no device specific minimum


but it was saying there was a minimum.

Today I enter the same command, but I don’t see the line any longer.

im an advanced user here.  can someone tell me how to enter the commands after im loogged in VIA filezilla and the SSH way using port 21

thanks 

You would need software like Puttyexe, which uses SSH by default on port 22, to issue command lines through a secure connection to the NAS, while FTP uses port 21 to move files around, and port 22 to move files around through an SSH (secure) tunnel.

From what I read, FileZilla is an application using Putty

https://wiki.filezilla-project.org/Howto

With Putty.exe, enter the local name of your cloud and start the login process. Putty.exe will open a terminal-like window where you enter the username (“root”) and the default pasword (“welc0me”). Remember to enable SSH in the dashboard


Etupes wrote:

You would need software like Puttyexe, which uses SSH by default on port 22, to issue command lines through a secure connection to the NAS, while FTP uses port 21 to move files around, and port 22 to move files around through an SSH (secure) tunnel.

From what I read, FileZilla is an application using Putty

https://wiki.filezilla-project.org/Howto

 

With Putty.exe, enter the local name of your cloud and start the login process. Putty.exe will open a terminal-like window where you enter the username (“root”) and the default pasword (“welc0me”). Remember to enable SSH in the dashboard


thanks bud I was not able to do it with filefilla but winSCP worked.  I have yet to check if this tweak worked on my 4tb seagate expansion drive.  

I tried all the above and my seagate expansion 4gb will not goto bed.  :angry:

@ lotust251

What does that command display?

hdparm -I /dev/sdb

spirit-of-mars wrote:

@ lotust251

 

What does that command display?

hdparm -I /dev/sdb

/root$ hdparm -I /dev/sdb

/dev/sdb:

ATA device, with non-removable media
Model Number: ST4000DM000-1F2168
Serial Number: S3009C1V
Firmware Revision: CC54
Transport: Serial, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0
Standards:
Used: unknown (minor revision code 0x001f)
Supported: 9 8 7 6 5
Likely used: 9
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: 7814037168
Logical Sector size: 512 bytes
Physical Sector size: 4096 bytes
Logical Sector-0 offset: 0 bytes
device size with M = 1024*1024: 3815447 MBytes
device size with M = 1000*1000: 4000787 MBytes (4000 GB)
cache/buffer size = unknown
Form Factor: 3.5 inch
Nominal Media Rotation Rate: 5900
Capabilities:
LBA, IORDY(can be disabled)
Queue depth: 32
Standby timer values: spec’d by Standard, no device specific minimum
R/W multiple sector transfer: Max = 16 Current = ?
Advanced power management level: 127
Recommended acoustic management value: 208, current value: 208
DMA: mdma0 mdma1 *mdma2 udma0 udma1 udma2 udma3 udma4 udma5 udma6
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
* Advanced Power Management feature set
Power-Up In Standby feature set
SET_FEATURES required to spinup after power up
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
* WRITE_{DMA|MULTIPLE}_FUA_EXT
* 64-bit World wide name
Write-Read-Verify feature set
* 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
* unknown 76[15]
DMA Setup Auto-Activate optimization
Device-initiated interface power management
* Software settings preservation
* SMART Command Transport (SCT) feature set
* SCT LBA Segment Access (AC2)
unknown 206[7]
unknown 206[12] (vendor specific)
* reserved 69[7]
Security:
Master password revision code = 65534
supported
not enabled
not locked
not frozen
not expired: security count
supported: enhanced erase
498min for SECURITY ERASE UNIT. 498min for ENHANCED SECURITY ERASE UNIT.
Logical Unit WWN Device Identifier: 5000c5006d3b14ae
NAA : 5
IEEE OUI : 000c50
Unique ID : 06d3b14ae
Checksum: correct

lotust251 wrote:

I tried all the above and my seagate expansion 4gb will not goto bed.  :angry:

I don’t have the My Cloud (regular) but instead have the My Cloud EX2
but I suspect My Cloud EX2’s behavior is the same as My Cloud’s in this aspect. It’s only couple days ago that I hooked up the 2nd USB drive
after hooking up the first USB drive, a WD My Book, few days before that. I didn’t notice it until I saw this message and investigated, since my My Cloud EX2 (and the USB drives) are in my other room that I don’t go in often. But I noticed that desite hours having passed between the last usage of my 2nd USB drive (Hitachi Touro), when I put my ear next to it I could hear the disk spinning. But the first USB drive (My Book) had it’s white LED light slowly blink in and out and according to the manual that’s an indication of it being in standby mode. What this told me is that my EX2 is able to put the WD USB drive into standby mode automatically BUT NOT the non-WD USB drive. I do have Drive Sleep ON in my EX2’s settings but obviously that doesn’t have any real impact on the USB drive if it’s a non-WD drive.

So I issued a ‘hdparm -y /dev/sdc’ command (/dev/sdc is my Hitachi USB drive) and then went and listened to the Hitachi drive and now I no longer heard the drive spin -it obviously now entered standby mode.

So this is my manual solution for now - but I will be scripting this for my EX2 soon soon so that it’s automated. I suspect, the manual solution will probably work for you as well (in your case it’s probably gonna be /dev/sdb since there’s only one USB port on the regular My Cloud. But of course that’s not a true solution.

Hello lotust251,

The important lines are:

Standby timer values: spec'd by Standard, no device specific minimum
Advanced power management level: 127

The first line indicates that your drive supports “spindown_time = 180” and “hdparm -S 180 /dev/sdb”.

The second line indicates that your drive supports “apm = 127” and “hdparm -B 127 /dev/sdb”.

180 and 127 are just examples. You can set other delays.

If your drive does not spin down after the chosen delay, then one or more processes must be reading from or writing to your drive.

See “3. Inactivity” in my previous post.

Hi Cybernut1,

You are right about ‘hdparm -y /dev/sdc’.

You can check the disk state (before and after) with ‘hdparm -C /dev/sdc’.

If your drive supports ‘hdparm -y’, then it should support ‘hdparm -S’ and ‘spindown_time = 
’ too.

Your drive could support only a restricted set of values for the spindown/standby delay.

The command ‘hdparm -I’ must report such a case.

hdparm -I /dev/sdb[...]Standby timer values: spec'd by Standard, no device specific minimum