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.

2 Answers 2

33

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.

4
  • 23
    Caution: many people report that hdparm -C wakes up the drive and recommend using smartctl -i -n standby instead. (see serverfault.com/questions/275364/… or serverfault.com/questions/204227/when-hdd-wakes-up) Feb 26, 2012 at 10:16
  • 1
    In testing BOTH hdparm -C and smartclt -i -n standby (Ubuntu Server 14.04.1 LTS)
    – STW
    Nov 10, 2014 at 13:04
  • Are there any "new and improved" solutions? Ideally, something which doesn't require superuser privileges?
    – user564181
    Nov 29, 2022 at 20:40
  • I have a drive that is awaked from spleep both by hdparm and smartcl commands. And another one that is not awaked by neither. Dec 25, 2022 at 10:30
2

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

2
  • 13
    FYI, Ubuntu 18.04 doesn't have /proc/d_suspdtime. Oct 29, 2020 at 13:24
  • 1
    seems that not normal kernel feature
    – yurenchen
    Apr 21, 2023 at 19:37

You must log in to answer this question.

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