In order to do disk rotation in a server, I need to know the current running time (online) time of a disk on a Linux CentOS release 6.3 (Final) system.

The disks are connected with SATA (e.g. /dev/sdc), are simple rotating type (Western Digital RE type disks), and are not organized in any RAID or similar.

I have tried to find it using smartctrl (as suggested in superuser.com/questions/279412), but was unable to find the information. Any suggestion for command ?

  • 2
    What do you mean you get no luck when running smartctrl? Do you get errors or what? How are the disks physically connected? Do you have a hardware RAID controller? You might not have an easy way to access any data with harware RAID. You really need to provide more details. – Zoredache Dec 10 '13 at 20:39
  • 1
    So what output do you get for smartctl --all /dev/sdc? You should see a section labeled Vendor Specific SMART Attributes with Thresholds. Do you see any values there? What exactly did you get? – Zoredache Dec 10 '13 at 20:54
  • Yes, thanks, found it, I assume it is "Power_On_Hours". Will update the post with result. – Morten Zilmer Dec 10 '13 at 20:58

Answer based on comments from @Zoredache:

Command is smartctl --all /dev/sdc and the section to look under is "Vendor Specific SMART Attributes with Thresholds", which has an attribute named "Power_On_Hours".

So command for just getting power on hours (runnning) is:

smartctl --all /dev/sdc | grep Power_On_Hours

Which can then show something like:

9 Power_On_Hours          0x0032   087   087   000    Old_age   Always       -       10171

The running time is thus: 10171 hours

| improve this answer | |
  • But in TOSHIBA MK3276GSX model this is not defined as Power_On_Hours. It is Power_On_Minutes or Loaded_Hours – chamzz.dot Dec 12 '19 at 5:53

If You put in NAGIOS check, You could do :

smartctl --all /dev/sda | grep Power_On_Hours | cut -d "-" -f2 | tr -d "[:blank:]"

On this way You don't waste time, connecting on server via ssh for example and typing command over and over.

Also, there is hdsentinel script, where You have Power on time row. There is example:

./HDSentinel | grep Power

Output should look like

Power on time: 1223 days, 16 hours

I generally prefer HDSentinel script, because it have HDD Health output. Smartctl is much more harder to analyze in term of Hard disk health, than hdsentinel.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.