35

Is there anyway to find out if a hard drive has spun down? I've been using the following command to spin it down after idle time:

hdparm -S 120 /dev/hdX

However I'm not sure it's working correctly and was wondering how to check the current power state to see if has correctly powered down.

phuclv
  • 30,396
  • 15
  • 136
  • 260
Jason
  • 351

2 Answers2

34

You can find out the power status with the -C flag to hdparm:

hdparm -C /dev/hdX

As explained by man 8 hdparm:

-C

Check the current IDE power mode status, which will always be one of unknown (drive does not support this command), active/idle (normal operation), standby (low power mode, drive has spun down), or sleep‐ ing (lowest power mode, drive is completely shut down). The -S, -y, -Y, and -Z flags can be used to manipulate the IDE power modes.

2

Important: This answer is not supposed to be one for your average desktop Linux. It was for a NAS-device, which most likely ran busybox. I'm adding this info at the front as the comments suggested that they didn't read the last line.


As I don't have hdparm nor smartctl available on my NAS I checked the /proc as I assumed that it had to be there somewhere, too.

Well, if it's down:

root@NAS:~# cat /proc/d_suspdtime
SuspendingTime = 15
Disk0: STANDBY
Disk1: No_Disk
root@NAS:~# 

If the kitten would go crazy on it:

root@NAS:~# cat /proc/d_suspdtime
SuspendingTime = 15
Disk0: ACTIVE
Disk1: No_Disk
root@NAS:~# 

I also got

root@NAS:/proc# cat /proc/d_suspdtime
SuspendingTime = 15
Disk0: NO_ACTIVE
Disk1: No_Disk
root@NAS:~# 

Guessing from some testing:

  • ACTIVE: the HDD did something within a certain timespan (it doesn't seem to mean that it does something right now)
  • NO_ACTIVE: there was some activity, but in a while it'll be going to standby
  • STANDBY: well, the HDD is in standby

And to be complete on this SuspendingTime is the time in minutes after the HDD should go to standby.

Since I'm no Unix-pro I can't tell if you are supposed to have /proc/d_suspdtime on your system, too (guessing from Google results it may be related to NAS or busybox).

sjngm
  • 2,143