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.

neverMind9
  • 1,680
  • 2
  • 18
  • 38

2 Answers2

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...

telcoM
  • 87,318
  • 3
  • 112
  • 232
  • 1
    The only problem is that in most consummer grade controllers SMART lies a lot/is not properly implemented. – Rui F Ribeiro Mar 06 '19 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. – telcoM Mar 06 '19 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.

iheartcsharp
  • 163
  • 4