Monitoring hard disk health with smartd under Linux or UNIX operating systems

by on May 3, 2006 · 13 comments· LAST UPDATED July 4, 2007

in , ,

smartd is SMART Disk Monitoring Daemon for Linux. SMART is acronym for Self-Monitoring, Analysis and Reporting Technology (SMART) system built into many ATA-3 and later ATA, IDE and SCSI-3 hard drives. The purpose of SMART is to monitor the reliability of the hard drive and predict drive failures, and to carry out different types of drive self-tests.

smartd works with following operating systems:

  1. Linux
  2. *BSD
  3. Windows
  4. Solaris etc

How do I Install smartd?

However, smartd is not installed by default. Following are distribution specific steps to install smartd:

Debian Linux:
# apt-get install smartmontools
Red hat/Fedora Linux:
# rpm –ivh kernel-utils
OR
# up2date kernel-utils
OR if you are using Fedora Linux
# yum kernel-utils
FreeBSD:
# pkg_add -r -v smartmontools

Before configuring hard disk for SMART monitoring make sure your hard disk is SMART capable:
# smartctl -i /dev/hda
Output:

smartctl version 5.34 [i686-pc-linux-gnu] Copyright (C) 2002-5 Bruce Allen
Home page is http://smartmontools.sourceforge.net/
=== START OF INFORMATION SECTION ===
Device Model:     SAMSUNG SV2002H
Serial Number:    0395J1FR904324
Firmware Version: RA100-04
User Capacity:    20,060,651,520 bytes
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   6
ATA Standard is:  ATA/ATAPI-6 T13 1410D revision 1
Local Time is:    Tue May  2 15:44:09 2006 IST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
You can configure the smartd daemon by editing the file /etc/smartd.conf. 

In 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.

Configure SMARTD

Debian Linux

  • Enable smart by editing /etc/default/smartmontools file.
  • Smart Configuration file: /etc/smartd.conf
  • Start/Stop smart: /etc/init.d/smartmontools start | stop

Red Hat Linux

  • Enable smart by editing /etc/smartd.conf file.
  • Smart Configuration file: /etc/smartd.conf
  • Start/Stop smart: /etc/init.d/smartd start | stop

FreeBSD

  • Enable smart by editing /etc/rc.conf file (add line smartd_enable=”YES").
  • Smart Configuration file: /etc/smartd.conf
  • Start/Stop smart: /usr/local/etc/rc.d/smartd.sh start | stop

Example

You can put following directives in Smart Configuration file:
(a) Send an email to alert@nixcraft.in for /dev/sdb:
/dev/sdb -m alert@nixcraft.in
(b) Read error log:
# smartctl -l error /dev/hdb
(c) Testing hard disk (short or long test):
# smartctl -t short /dev/hdb
# smartctl -t long /dev/hdb

Caution smartd is a monitoring tool not a backup solution. Always perform data backup.

See also:

  • More information on the smarttool see official home page.
  • Read man page of smartd and smartd.conf for configuration help.
TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 13 comments… read them below or add one }

1 soraver February 26, 2008 at 11:21 am

Just to add that if you get the “Device does not support SMART” error with the “smartctl -i /dev/hda” command, but hddtemp or another smart based app is working, you might need to add the “-d ata” option :D

# smartctl -i /dev/sdb
smartctl version 5.36 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

Device: ATA SAMSUNG HD501LJ Version: CR10
Serial number: S0MUJ1QP503708
Device type: disk
Local Time is: Tue Feb 26 13:18:16 2008 EET
Device does not support SMART

# smartctl -i /dev/sdb -d ata
smartctl version 5.36 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== START OF INFORMATION SECTION ===
Device Model: SAMSUNG HD501LJ
Serial Number: S0MUJ1QP503708
Firmware Version: CR100-10
User Capacity: 500,107,862,016 bytes
Device is: In smartctl database [for details use: -P show]
ATA Version is: 8
ATA Standard is: Not recognized. Minor revision code: 0×52
Local Time is: Tue Feb 26 13:20:56 2008 EET

==> 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

:)

Reply

2 richard April 19, 2011 at 12:28 am

thank yes i know now
i have expansion but no indexing on it and thats true for the main bios@133mhz
amd dimm :/ irq”s determined and requesting 16mb diskette
what can i do?????

Reply

3 Tweeks December 10, 2008 at 4:23 pm

So what about motherboard based SATA controllers (such as sata_via)? How am I supposed to poll such sata drives? Neither -d ata nor -d sat works…? The actual drive kernel module is sata_via.. which in turn uses libata (it appears):
# lsmod |grep ata
sata_via 4208 2
libata 44124 0 [sata_via]
scsi_mod 105512 2 [sata_via libata sd_mod]

So why can’t I poll the drive w/smartctl? It is because this functionality is broken in sata_via?

Tweeks

Reply

4 Mohanad S.Azzam May 16, 2009 at 12:00 pm

hi
I wanna know the model of My HDD that already insatlleh in HP server model DL380.

I am very far from the site ,and i cant travel there to know the toal model number and details of old HDD .

it is possible to do command by linux to show me all the details and model numbers of my HDD ?

OS in redhat linux 4.
thanks ..

Reply

5 Ashish Dhabarde January 11, 2012 at 9:44 am

try hdpram command……hope it will help u

Reply

6 Charon July 31, 2009 at 7:09 am

for Fedora:
yum install smartmontools

Reply

7 Dipak Zope September 8, 2009 at 7:18 am

Can we configure smartd.conf to run some commands as soon as smartd catches disk failure?
I would like to stop a service which is nothing but my application, to prevent from corruption of its database, as soon as smart demon found any disk failure.
Can anyone please help me and guide about how to do it?

Reply

8 tmohanta October 22, 2010 at 4:21 am

Hi,
I have a linux server and different JBODs are connected to it i.e SAS enclouser, SATA enclouser ,FC enclouser , SCSI enclouser and SAS enclouser SAS and SATA drives are mixed. All the disks are in hardware raid (raid-1 or raid-6 or raid-5).

(1) I want to know the hard disk type- SATA ,SAS, FC etc.
In linux the device I am seeing as /dev/sda where 6 disks are there. The output I need as follows
/dev/sda disk serial no disk type size raid_type
/dev/sda ABCD121 SATA 1TB raid-5
/dev/sda ABCD122 SAS 1TB raid-5
/dev/sda ABCD123 FC 1TB raid-5
/dev/sda ABCD124 SCSI 1TB raid-5
/dev/sda ABCD125 IDE 1TB raid-5
/dev/sda ABCD126 SATA 1TB raid-5

I am planning to write the passthrough and ventor independent solution is required.
Any help on it.

Thanks in advance..

Thanks & Regds,
tmohanta

Reply

9 Reynold P J January 10, 2011 at 5:30 pm

Really helpful…
Thank you so much:)

Reply

10 thiyagi July 26, 2011 at 11:22 am

Nice info..

Reply

11 Stefan Lasiewski January 13, 2012 at 8:50 pm

I see that smartctl is often from from a cronjob (On FreeBSD, it can be run from periodic). What is the advantage of running a smartd daemon vs. running smartctl via cron?

Reply

12 kiranjith April 4, 2012 at 9:57 am

smartctl -d ata –attributes –log=selftest /dev/sda

Gives u the output of short and long test.

/kiran

Reply

13 aprogrammer April 1, 2014 at 8:05 am

Thanks for the post. I was using this instruction – http://sysadmin.te.ua/linux/smartd.html . It has more explanation about separate smartd log files, almost all smartd.conf options and debug all smartd process (email sending, logs output,daemon startup options)

Reply

Leave a Comment

Tagged as: , , , , , , , , , , , , , , ,

Previous post:

Next post: