I eventually got round to installing SMART tools on my home Linux server, so now if one of the hard disks decides to start playing up or fails, I should get a nice little e-mail telling me there’s a problem. I’ve already set up e-mail on my server so I won’t go into how to set it up here, you can read all about it yourself on the Official Ubuntu Documentation pages.
First thing you need to do is install smarttools
sudo apt-get install smartmontools
Before configuring your hard disk(s) for SMART monitoring, make sure your hard disk is SMART capable:
sudo smartctl -i /dev/sda
You should get output similar to this
smartctl version 5.37 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce Allen Home page is http://smartmontools.sourceforge.net/ === START OF INFORMATION SECTION === Device Model: SAMSUNG HD154UI Serial Number: S1XWJ1KZ209937 Firmware Version: 1AG01118 User Capacity: 1,500,301,910,016 bytes Device is: In smartctl database [for details use: -P show] ATA Version is: 7 ATA Standard is: Not recognized. Minor revision code: 0x52 Local Time is: Wed Oct 27 10:49:28 2010 BST > WARNING: May need -F samsung or -F samsung2 enabled; see manual for details. SMART support is: Available - device has SMART capability. SMART support is: Enabled
In the above output the lines:
SMART support is: Available - device has SMART capability. SMART support is: Enabled
Indicates that it is SMART capable and it is enabled.
At this point you need to read the manual page and decide what you want smartctl to do for you, I initially set mine up to do a long test and a short test and upon finding any problems to e-mail me.
Below is what was in my /etc/smartd.conf file, I used this to test smartd and ensure that the e-mail part was working correctly.
After I tested, I removed the “-M test“ part below.
/dev/sda -a -d sat -I 194 -m email@example.com -M test -s (S/../.././02|L/../../6/03) /dev/sdb -a -d sat -I 194 -m firstname.lastname@example.org -M test -s (S/../.././02|L/../../6/03)
Below is the e-mail I received in my inbox from the smartd daemon.
After removing the “-M test” from /etc/smartd.conf, you would only get this e-mail if there was a genuine problem.
This email was generated by the smartd daemon running on: host name: orion DNS domain: linuxhome.co.uk NIS domain: (none) The following warning/error was logged by the smartd daemon: TEST EMAIL from smartd for device: /dev/sda For details see host's SYSLOG (default: /var/log/messages).