Viewing hard drive temperatures on Linux hosts


While reviewing the sensor data provided by lm-sensors, I started to wonder if there was an easy way to list hard drive temperatures. The smartctl utility can show this information per drive, but I wanted something that would dump temperatures for all drives in my systems. After a bit of searching, I came across the hddtemp utility:

$ hddtemp /dev/sda /dev/sda1 /dev/sda2 /dev/sda3 /dev/sda4 /dev/sdb /dev/sdb1 /dev/sdb9 /dev/sdc /dev/sdc1 /dev/sdc9 /dev/sdd /dev/sdd1 /dev/sde

/dev/sda: HITACHI HDS7225SBSUN250G0 36N4US6Y J ?: 35°C
/dev/sdb: WDC WD7500AACS-00D6B1: 37°C
/dev/sdc: WDC WD7500AACS-00D6B1: 36°C
/dev/sdd: WDC WD7500AACS-00D6B1: 38°C

I haven’t read through the hddtemp source code to see if it is using ioctl()‘s or /sys to get this information, but I’m stoked that this information is so easy to get to (tying this into Nagios would be kinda nifty). Viva CentOS Linux!

This article was posted by Matty on 2009-04-30 10:37:00 -0400 -0400