SMART stands for Self-Monitoring, Analysis and Reporting Technology and is built into most modern hard disks. The smartd daemon is part of smartmontools and monitors a disk’s SMART data for any signs of hardware problems. SMART is available with Parallel and Serial ATA disks, drives appearing as either /dev/hd* or /dev/sd*, respectively. Use the following command to obtain relevant information for your system:
user@ubuntu:~$ df -hl
If required, start by configuring postfix to redirect mail for the local root user. Get the necessary packages with the following command:
user@ubuntu:~$ sudo apt-get install smartmontools bsd-mailx
Edit the file /etc/smartd.conf and comment out any lines beginning with DEVICESCAN. If you are using a netbook or a laptop, add the following line for the smartd daemon to monitor the device /dev/sda:
/dev/sda -a -d ata -n standby -o on -S on -m root -M daily -M test
If you are using a desktop or a server, add the following line for the smartd daemon to monitor the device /dev/hda:
/dev/hda -a -d ata -n never -o on -S on -s (L/../../7/04|S/../.././02) -m root -M daily -M test
See man smartd.conf for more information on how to tailor the operation of smartd to your needs.
Edit the file /etc/default/smartmontools and uncomment the line containing start_smartd=yes. Restart the smartd daemon with the following command:
user@ubuntu:~$ sudo /etc/init.d/smartmontools restart
Verify that the local root user has received a test message from the smartd daemon. From now on, the smartd daemon will monitor the disk and, in the event of impending disk failure, alert the local root user by email.