4

Apparently, hdparm only works with internal HDD's.
How do I avoid an external HDD from spinning down after half a minute?

One way is to read one sector using badblocks or dd each 29 seconds in an infinite loop.

Is there another way to keep the HDD spinning?

Edit: SMART is also not supported by that HDD. hdparm -y also does not work, but works for a different external HDD.

4
  • 1
    Make and model of HD? Commented Mar 7, 2019 at 11:51
  • @roaima Intenso Box 4TB. Very common in Europe. Commented Mar 7, 2019 at 13:24
  • 1
    That's the make of the casing. What's the make and model of disk? Commented Mar 7, 2019 at 15:01
  • @roaima Model of the disk? Not sure. (lsblk -S does only show “External USB 3.0 HDD” or something similar.) Commented Mar 7, 2019 at 18:15

3 Answers 3

2

From the DESCRIPTION paragraph of man hdparm:

hdparm provides a command line interface to various kernel interfaces supported by the Linux SATA/PATA/SAS "libata" subsystem and the older IDE driver subsystem. Many newer (2008 and later) USB drive enclosures now also support "SAT" (SCSI-ATA Command Translation) and therefore may also work with hdparm. E.g. recent WD "Passport" models and recent NexStar-3 enclosures. Some options may work correctly only with the latest kernels.

So yes, hdparm will work with some external HDDs: basically all eSATA HDDs and those USB HDDs which are using SCSI-ATA Command Translation.

For specifically Western Digital HDDs, there is also the idle3-tools package. If you can read the SMART information from your WD external drive, then idle3-tools should also work.

And it's likely you could take the drive out of the enclosure, plug it into an internal SATA cable, use hdparm to change its settings persistently, and then place it back into the external enclosure. Of course that voids the warranty, if you care about that...

2
  • 1
    The only problem is that in most consummer grade controllers SMART lies a lot/is not properly implemented. Commented Mar 6, 2019 at 15:54
  • 1
    The idea is, if the USB-to-SATA adapter chip in the external enclosure can pass through the SMART commands, then the commands of the idle3-tools should also pass through the adapter chip to the actual disk. Commented Mar 6, 2019 at 16:08
1

See this answer here: https://askubuntu.com/a/1215772/644005

Basically, it says to use sdparm rather than hdparm. I was able to get it to work on all of my external Western Digital USB 3.0 HDDs.

This is the command I ran to disable the drive going into sleep mode:

sudo sdparm -l --save --set STANDBY=0 /dev/sd? 

It also mentions the SCT setting, which refers to the timeout value. I didn't change the SCT value. If you want to increase the timeout value you can do it like this:

sudo sdparm -l --save --set SCT=6000 /dev/sd? 

The SCT value is in milliseconds, so 6000 means 6 seconds.

0

iheartcsharp's answer even works on Windows. Compiling sdparm with MinGW didn't work, it didn't recognize SCT or STANDBY, but the latest sdparm_64 binary I could find, 1.10 20160222, from here, did work.

My external 12 TB Elements drive was seemingly spun down whenever I went to copy files to it, whereas my other external Seagate drive has practically never spun down. sdparm's output backs that up.

Administrator@~ MINGW64 /j/compile/sdparm/src # ./sdparm_64.exe --wscan ... PD13 [K] WD Elements 25A3 1029 serial# Administrator@~ MINGW64 /j/compile/sdparm/src # ./sdparm_64.exe PD13 PD13: WD Elements 25A3 1029 Power condition mode page: PM_BG 0 [cha: n, def: 0, sav: 0] Administrator@~ MINGW64 /j/compile/sdparm/src # ./sdparm_64.exe --get SCT PD13 PD13: WD Elements 25A3 1029 SCT 18000 [cha: y, def:18000, sav:18000] Administrator@~ MINGW64 /j/compile/sdparm/src # ./sdparm_64.exe --save --set STANDBY=0 PD13 PD13: WD Elements 25A3 1029 Administrator@~ MINGW64 /j/compile/sdparm/src # ./sdparm_64.exe --get STANDBY PD13 PD13: WD Elements 25A3 1029 STANDBY 0 [cha: y, def: 1, sav: 0] Administrator@~ MINGW64 /j/compile/sdparm/src # ./sdparm_64.exe --get SCT PD13 PD13: WD Elements 25A3 1029 SCT 18000 [cha: y, def:18000, sav:18000] Administrator@~ MINGW64 /j/compile/sdparm/src # ./sdparm_64.exe --save --set SCT=999999999 PD13 PD13: WD Elements 25A3 1029 mode select (10): Fixed format, current; Sense key: Recovered Error Additional sense: Rounded parameter Administrator@~ MINGW64 /j/compile/sdparm/src # ./sdparm_64.exe --get SCT PD13 PD13: WD Elements 25A3 1029 SCT 288000 [cha: y, def:18000, sav:288000] Administrator@~ MINGW64 /j/compile/sdparm/src # ./sdparm_64.exe --get STANDBY PD12 PD12: Seagate Expansion Desk 9401 STANDBY not found in Power condition mode page Administrator@~ MINGW64 /j/compile/sdparm/src # ./sdparm_64.exe --get SCT PD12 PD12: Seagate Expansion Desk 9401 SCT not found in Power condition mode page 

288 seconds seems to be the maximum spindown time, but it shouldn't matter with standby set to 0.

Probably bad form to add this as a "top level" answer, but this is one of the first search results I got while trying to figure out how to keep this drive from going to sleep, hoping it helps someone.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.