Linux, Tech

Hard disk health monitoring in Debian Lenny using smartmontools

Install smartmontools from the repository.

thinkpad:~# aptitude install smartmontools

Enable SMART monitoring on the SATA drive.

thinkpad:~# smartctl -s on  -d ata /dev/sda

Check the health of the drive.

thinkpad:~# smartctl -d ata -H /dev/sda
smartctl version 5.38 [i686-pc-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

Run a short self test on the drive and check the test log.

thinkpad:~# smartctl -t short /dev/sda
thinkpad:~# smartctl -l selftest /dev/sda
smartctl version 5.38 [i686-pc-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== START OF READ SMART DATA SECTION ===
SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Short offline       Completed without error       00%      4156         -

In order to configure smartd to monitor the hard disk, enable it in /etc/default/smartmontools.

# uncomment to start smartd on system startup
start_smartd=yes

Set the schedule and monitoring options by editing /etc/smartd.conf. Comment out all the DEVICESCAN lines and add a line for the main hard drive.

# First (primary) ATA/IDE hard disk.  Monitor all attributes, enable
# automatic online data collection, automatic Attribute autosave, and
# start a short self-test every day between 2-3am, and a long self test
# Saturdays between 3-4am. Send mail on SMART failures
/dev/sda -a -o on -S on -s (S/../.././02|L/../../6/03) -m naveen@localhost

Start the smart daemon.

thinkpad:~# /etc/init.d/smartmontools restart
 * Restarting S.M.A.R.T. daemon smartd                        [ OK ]
Advertisements
Standard