42

I have used of hdparm -n and smartctl -A but it always seem to be a "per drive" technique as a drive may answer for only one of these tools.

So, is there a standard way to get the drive temperature on Linux (HDD or SSD)? If not, what (other) tools can I use to get this information?

Totor
  • 19,302
  • 17
  • 75
  • 102

6 Answers6

49

I like hddtemp, which provides a pretty standard way of getting the temperature for supported devices. It requires SMART support though.

Example Usage: sudo hddtemp /dev/sd[abcdefghi]

Example Response:

/dev/sda: WDC WD6401AALS-00J7B0: 31°C
/dev/sdb: WDC WD7501AALS-00J7B0: 30°C

AdminBee
  • 21,637
  • 21
  • 47
  • 71
Cry Havok
  • 2,018
  • 14
  • 11
5

All SMART-capable devices should respond to smartctl. And I guss that only smart-devices have a temperature reading.

All other tools will propably be more or less vendor-specific (like Dell`s omsa). IPMI might be another generic approach, but I doubt, that a temperature-reading of a storage-device is standard there.

Totor
  • 19,302
  • 17
  • 75
  • 102
Nils
  • 18,202
  • 11
  • 46
  • 82
4

As mentioned by Rovanion, to list all drives in one go:

hddtemp /dev/sd?

Or, if you prefer a for loop:

for i in /dev/sd[a-z]; do hddtemp "$i"; done
RyanH
  • 193
  • 6
4
# ls -1 /dev/sd? | xargs -n1 smartctl -A | grep Celsius
194 Temperature_Celsius     0x0022   043   049   000    Old_age   Always       -       43 (0 25 0 0 0)
194 Temperature_Celsius     0x0022   034   041   000    Old_age   Always       -       34 (0 18 0 0 0)
194 Temperature_Celsius     0x0022   042   047   000    Old_age   Always       -       42 (0 21 0 0 0)
194 Temperature_Celsius     0x0022   046   053   000    Old_age   Always       -       46 (0 24 0 0 0)
194 Temperature_Celsius     0x0022   044   050   000    Old_age   Always       -       44 (0 25 0 0 0)
194 Temperature_Celsius     0x0022   044   050   000    Old_age   Always       -       44 (0 24 0 0 0)
Bram
  • 849
  • 9
  • 12
3

You might want to try watch "sensors && sudo hddtemp /dev/sd?" which provides cpu and other temperature information in addition.

Freddy
  • 25,172
  • 1
  • 21
  • 60
lnappa
  • 31
  • 2
0

To make life easier, I have added this line to .bash_aliases:

alias hddtemp='sudo hddtemp /dev/sd*[^[:digit:]] |sort -k3rn'

Now, one gets:

$ hddtemp
    /dev/sda: Generic MassStorageClass: S.M.A.R.T. not available
    /dev/sde: WDC WD20EFRX-68EUZN0: 35°C
    /dev/sdf: WDC WD20EFRX-68EUZN0: 34°C
    /dev/sdg: WDC WD20EFRX-68EUZN0: 36°C
Serge Stroobandt
  • 2,314
  • 3
  • 32
  • 36