44

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?

6 Answers 6

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

5
  • 13
    A shorter way would be hddtemp /dev/sd?.
    – Rovanion
    Commented Jun 28, 2016 at 22:39
  • 3
    /dev/sd? spares even more fingers. Commented Jan 2, 2018 at 22:35
  • 1
    Don't forget the type prefix (PATA/SATA/SCSI) for some devices; this 8-bay UASP tower needs the SATA prefix or else I don't get any temperatures: sudo hddtemp SATA:/dev/sd{a..h}
    – genpfault
    Commented May 17, 2019 at 2:58
  • I'm getting "drive supported, but it doesn't have a temperature sensor." for every drive on my system, which is NOT true - the temps are reported in smartctl.
    – ghostly_s
    Commented Feb 24, 2022 at 15:31
  • And how do you hide messages that do not have a temperature or are not supported?
    – acgbox
    Commented Jan 19, 2023 at 20:19
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.

1
  • Oh yeah, in general terms you can read the output of a thermistor using the cee language... it's like so obvious. (this answer is overly-generic) Commented Dec 7, 2021 at 20:13
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
0
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)
3

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

1
  • 1
    That's assuming lm-sensors is installed
    – Gordster
    Commented Dec 9, 2020 at 14:23
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

You must log in to answer this question.

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