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.