Monitor hard drive temperature

Over heatIn this article we will discuss how to monitor your hard drives for high temperature using smartctl and hddtemp. smartd is SMART Disk Monitoring Daemon for Linux. SMART is acronym for Self-Monitoring, Analysis and Reporting Technology (SMART) system built into many ATA-3 and later ATA, IDE and SCSI-3 hard drives. The purpose of SMART is to monitor the reliability of the hard drive and predict drive failures, and to carry out different types of drive self-tests. On the other hand, hddtemp is a small utility (daemonizable) that gives you the temperature of your hard drive by reading S.M.A.R.T. informations (for drives that support this feature).

To install hddtemp under Debian or Ubuntu Linux, type:
$ sudo apt-get install hddtemp
If you are already logged in as root don't type sudo.

Install hard disk temperature database at /usr/share/misc or /etc directory:
$ cd /usr/share/misc
# wget http://download.savannah.nongnu.org/releases/hddtemp/hddtemp.db

Usage:

root@pappous:# hddtemp /dev/sda
/dev/sda: WDC WD740GD-50FLC0: 43°C

or

root@pappous:# smartctl -d ata -A /dev/sda | grep -i temperature
194 Temperature_Celsius     0x0022   107   094   000    Old_age   Always       -       43

Sample script to turn off your computer when temperature goes over 59oC

 

#!/bin/bash
HDDS="/dev/sda /dev/sdb /dev/sdc /dev/sdd"
HDT=/usr/sbin/hddtemp
LOG=/usr/bin/logger
DOWN=/sbin/shutdown
ALERT_LEVEL=59
for disk in $HDDS
do
  if [ -b $disk ]; then
	HDTEMP=$($HDT $disk | awk '{ print $4}' | awk -F '°' '{ print $1}')
        if [ $HDTEMP -ge $ALERT_LEVEL ]; then
           $LOG "System going down as hard disk : 
           $disk temperature $HDTEMP°C crossed its 59 oC limit"
           sync;sync
           $DOWN -h 0
        fi
  fi
done



 

Posted on: 20/07/2010








0 Comments
If you want to leave a comment please Login or Register