Monitoring hard disk health with smartmontools

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:

start_smartd=yes

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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: