I always install smartmontools when I use SMART-enabled hard drives. It wasn’t until recently, though, that I started automating the tests.
Here’s a link that explains it: http://www.captain.at/howto-linux-smartmontools-smartctl.php.
Based on that, here’s the code I added to my /etc/smartd.conf:
# Per http://www.captain.at/howto-linux-smartmontools-smartctl.php
DEVICESCAN -d sat -a -o on -S on -s (S/../.././19|L/../../3/21|C/../.././20) -m root
# -d sat because /dev/sdX doesn't seem to run without it
# S/../.././19 = short test every day at 19:00
# C/../.././20 = conveyance test every day at 20:00
# L/../../3/21 = long test every wednesday (3) at 21:00
# -m root = root will be emailed if anything strange occurs
Note that this has to come before any other DEVICESCAN (apparently the first one takes priority). Don’t forget to kill -HUP the smartd process so the new config will take effect, and make sure /etc/default/smartmontools has uncommented:
After this, you can get useful info with:
sudo smartctl -l selftest /dev/sda
(or whatever drive you care about).
A very good description of the output of smartctl can be found at: www.cyberciti.biz/tips/linux-find-out-if-harddisk-failing.html