Retrieving hard disk temperature on an embedded NAS system

A few years ago, I bought a Zyxel NSA310 single-disk 2TB NAS system. Thanks to Peter I have had a Debian squeeze – now wheezy – chroot running on it ever since.

Recently I was going over my monitoring setup, and noticed that the hard disk temperature was not monitored, even though Observium (my graphing weapon of choice) does have an agent script for this, using the hddtemp daemon. If I had thought of this sooner, I could have compared the running temperature of a 2TB WD Green to a 3TB WD Red which I installed a few weeks ago.

Unfortunately, just installing the hddtemp package did not yield the expected result:

# hddtemp /dev/sda
/dev/sda: WD30EFRX-68AX9N0: S.M.A.R.T. not available

SMART champion smartmontools came back with the same issue:

# smartctl -a /dev/sda|grep SMART
Device does not support SMART

But then I remembered something I’ve had to do on other controllers as well: smartmontools can use different ways to get to the data, depending on which controller is used. A quick dmesg showed this board used a Marvell chip, so this command did show my SMART details:

# smartctl -a -d marvell /dev/sda|grep SMART
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

Great news: this means the controller was not masking the smart data somehow (like some USB bridges tend to do), but it was freely available. A quick peek through the hddtemp manpage showed the autodetection mechanism may be failing, so I forced it and tada:

# hddtemp SATA:/dev/sda
/dev/sda: WDC WD30EFRX-68AX9N0: 41°C

Configuring this method for the hddtemp daemon means you have to specify a list of devices and not rely on autodetection; edit the following in /etc/default/hddtemp:

# List of devices you want to use with hddtemp. If none specified,
# hddtemp will probe standard devices.
DISKS="SATA:/dev/sda"

This (obviously) makes the Observium “hddtemp” agent script work as well, so now I have graphs for my hard drive temperature:

nalia-hddtemp

This same method may apply to other SATA/Linux-based NAS systems, or even larger systems with specific controllers.

Writing informative technical how-to documentation takes time, dedication and knowledge. Should my blog series have helped you in getting things working the way you want them to, or configure certain software step by step, feel free to tip me via PayPal (paypal@powersource.cx) or the Flattr button. Thanks!