3

How can I determine through the command line whether or not an external drive that is connected to my system is awake (spinning) or sleeping?

None of the answers here have helped. The Powershell method doesn't work at all, and the smartctl method is described below. I also haven't tried the hdparm method because I'm trying this on Windows and according to numerous posts online the command hdparm -C will wakeup the drive anyway.

Testing an external Seagate drive.

Command used:

smartctl -n standby G:

The above works only when the drive is awake, and it instantly reports:

Device is in ACTIVE or IDLE mode

However if the drive is sleeping, the command hangs for 1-2 minutes and then it reports:

CHECK POWER MODE: incomplete response, ATA output registers missing
CHECK POWER MODE not implemented, ignoring -n option
ATA device successfully opened

You could say that the different error message solves this question but I'm hoping to find a clean solution where I won't have to wait for a couple of minutes to get an incomplete response. This is going to be used in a script that probes all connected disks. Also it doesn't always work like that, see below.

Testing an external WD drive.

The above command shows the same message either if the drive is spinning or not:

CHECK POWER MODE: incomplete response, ATA output registers missing
CHECK POWER MODE not implemented, ignoring -n option
ATA device successfully opened

However it doesn't hang like before and the response is instant.

Testing an internal WD drive.

When the drive is spinning:

Device is in ACTIVE or IDLE mode

When the drive is sleeping:

Device is in STANDBY (OS) mode, exit(2)

This is the only case where it works as expected.

2 Answers 2

3

You can’t do this unless the external drive’s bridge board somehow conveys that information.

All of the Windows commands you refer to are related to drives that are directly connected to a system’s motherboard. When a drive is connected directly to the system’s motherboard, the extra data connections are what allow those commands to work.

In the case of an external drive, the drive is connected to your system via a bridge board. The board basically manages taking USB commands and translating them to commands the core hard drive’s interface uses: Whether it be SATA, PATA, IDE, etc…

In the most common type of external drive setup — and you mention “external Seagate drive” — a SATA drive connects to a bridge board which allows for a USB connection to the drive. That USB connection is mainly there to read and write data; not convey other data such as SMART data or data related to drive sleep/wake state.

As this macOS-specific blog post from Other World Computing states:

“In addition, external and USB drives are usually not SMART-enabled.”

The post might be macOS specific, but the general concept is the same: External drives are usually not SMART-enabled.

The only way you could get that extra data sent back through and external connection is if the bridge board somehow conveys that data. Or if the connection is something like eSATA connection which is honestly an oddball external connection.

I’m not too sure if old school SCSI devices could send such data bace externally as well as internally, but if I recall correctly, there’s very little difference between SCSI internal versus external protocols so possibly system level commands that would convey deeper data for internal SCSO drives could be used for external SCSI drives as well.

But that is all academic nowadays in a world where the most typical connection between an external drive to a system is a USB connection of some kind.

PS: In some cases, a manufacturer will provide some kind of proprietary software that would allow your main system OS to connect directly to the bridge board in an external device. This is typically used for flashing the firmware on the bridge board but might convey deeper disk data such as SMART status. But that is a big “might”; the proprietary software only connects to the external drive in the way the manufacturer wants it to. And will only convey the data the manufacturer wants to provide. And will most likely not convey any deeper data in a way common internal hard drive commands would need them.

4
  • 1
    It's strange but I have just tried the following by adding the device flag: smartctl -d ata -n standby G: and it works as expected. When the drive is sleeping, I get an instant reponse: Device is in STANDBY (OS) mode, exit(2). When the drive is spinning I also get an instant responde: Device is in ACTIVE or IDLE mode. The responses are correct as far as I can see. Do you think that they can be trusted?
    – AndroidX
    Sep 12, 2021 at 16:17
  • 1
    @AndroidX Maybe! I am not a Windows person; mainly macOS and Linux here. And to my knowledge what I posted is correct: Direct commands to a hard drive won't work as expected for external devices like this. But maybe there is something about the way that Windows handles SMART commands that is different from the way macOS and Linux handle SMART commands. As this macOS-specific blog post from Other World Computing states: “In addition, external and USB drives are usually not SMART-enabled.” Sep 12, 2021 at 16:20
  • I didn't mark your answer as accepted since the addition of the -d option seems to solve my particular question (I've tested it on all the drives mentioned above). I have upvoted your answer instead, thank you.
    – AndroidX
    Sep 13, 2021 at 12:53
  • @AndroidX Fair enough. Makes me wonder if the same commands can be used in macOS and Linux as well and if they actually convey useful data. But congratulate you on self-solving this in a way. Sep 13, 2021 at 17:17
1

After reading the manpage I found by accident the -d option which lets you specify "the type of device". So the following command seems to work as expected:

smartctl -d ata -n standby G:

When the drive is sleeping, I get an instant reponse:

Device is in STANDBY (OS) mode, exit(2).

When the drive is spinning I also get an instant responde:

Device is in ACTIVE or IDLE mode.

I'm not sure why -d ata works but -d sat doesn't, though.

The command has to be run in an elevated prompt on Windows, otherwise it will give false results for some disks: for example my internal WD drive is always being reported as ACTIVE if the command is issued on a non-elevated prompt.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .