Last modified: Feb. 16, 2009
Contents
1 - Summary
2 - Dependencies
3 - Smartmontools installation
4 - Service configuration
5 - Smartctl examples
6 - Service check
1 - Summary
This guide will show how to install smartmontools in Red Hat Enterprise Linux.
Smartmontools can run tests to monitor the SMART of hard disks. This has been
tested in Red Hat Enterprise Linux 4 and 5.
2 - Dependencies
You will need to have Red Hat Enterprise Linux configured to send emails using
sendmail. Also, it's helpful to know what type of hard disk the computer has.
You can find this out by typing the following.
# sudo /sbin/fdisk -l | grep Disk
Disk /dev/hda: 41.1 GB, 41110142976 bytes
In this case our drive is hda. Get more information about the hard disk by
typing the following. For IDE and SATA drives you will get results.
# sudo /sbin/hdparm -I /dev/hda
/dev/hda:
ATA device, with non-removable media
Model Number: Maxtor 6E040L0
Serial Number: E1MJ8Y2E
Firmware Revision: NAR61590
Standards:
Used: ATA/ATAPI-7 T13 1532D revision 0
Supported: 7 6 5 4
Configuration:
Logical max current
cylinders 16383 16383
heads 16 16
sectors/track 63 63
--
CHS current addressable sectors: 16514064
LBA user addressable sectors: 80293248
device size with M = 1024*1024: 39205 MBytes
device size with M = 1000*1000: 41110 MBytes (41 GB)
Capabilities:
LBA, IORDY(can be disabled)
Standby timer values: spec'd by Standard, no device specific minimum
R/W multiple sector transfer: Max = 16 Current = 16
Advanced power management level: unknown setting (0x0000)
Recommended acoustic management value: 192, current value: 128
DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 *udma5 udma6
Cycle time: min=120ns recommended=120ns
PIO: pio0 pio1 pio2 pio3 pio4
Cycle time: no flow control=120ns IORDY flow control=120ns
Commands/features:
Enabled Supported:
* SMART feature set
Security Mode feature set
* Power Management feature set
* Write cache
* Look-ahead
* Host Protected Area feature set
* WRITE_VERIFY command
* WRITE_BUFFER command
* READ_BUFFER command
* NOP cmd
* DOWNLOAD_MICROCODE
Advanced Power Management feature set
SET_MAX security extension
* Automatic Acoustic Management feature set
* Device Configuration Overlay feature set
* Mandatory FLUSH_CACHE
* FLUSH_CACHE_EXT
* SMART error logging
* SMART self-test
Security:
Master password revision code = 65534
supported
not enabled
not locked
not frozen
not expired: security count
not supported: enhanced erase
HW reset results:
CBLID- above Vih
Device num = 0 determined by CSEL
Checksum: correct
Now, with the model of the hard drive find out if it's ATA, SCSI or SAT.
3 - Smartmontools installation
In Red Hat Enterprise Linux 4 the smartmontools package isn't included, but
the smartd and smartctl binaries are included. In Red Hat Enterprise Linux 5
you can install the smartmontools package from Red Hat.
# sudo rpm -ivh smartmontools-*.rpm
4 - Service configuration
In Red Hat Enterprise Linux 4 stop the smartmontools service.
# sudo /sbin/service smartd stop
Shutting down smartd: [ OK ]
Find where the smartmontools daemon was installed to. In Red Hat Enterprise
Linux 4 you can run the following.
# whereis smartd
smartd: /usr/sbin/smartd /etc/smartd.conf /usr/share/man/man8/smartd.8.gz
In Red Hat Enterprise Linux 5 you can run the following.
# rpm -ql smartmontools-* | grep sbin
/usr/sbin/smartctl
/usr/sbin/smartd
/usr/sbin/smartd-conf.py
/usr/sbin/smartd-conf.pyc
/usr/sbin/smartd-conf.pyo
Edit the init.d script to have the following. In Red Hat Enterprise Linux 4
you will have to create this file.
smartd_opts="-p /var/run/smartd.pid -q never"
# sudo vi /etc/sysconfig/smartmontools
# sudo chmod 644 /etc/sysconfig/smartmontools
Enable the smartmontools service so that it will start when the system
starts up.
# sudo /sbin/chkconfig smartd on
# sudo /sbin/chkconfig --list smartd
smartd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Find where the configuration file should be put.
# grep smartd.conf /etc/rc.d/init.d/smartd
[ ! -f /etc/smartd.conf ] || read DUMMY GEN_CONF DUMMY /dev/null >/etc/smartd.conf.new-autogenerated \
&& mv -f /etc/smartd.conf.new-autogenerated /etc/smartd.conf
# strings /usr/sbin/smartd | grep smartd.conf
/etc/smartd.conf
Device: %s, no SMART Self-Test log; remove -l selftest Directive from smartd.conf
Device: %s, no SMART Error log; remove -l error Directive from smartd.conf
Try adding '-d ata' to the smartd.conf config file line.
You can create your own configuration file. Here is a simple example. This
will disable Autosave and will schedule a short self-test between 12-1 PM every
night and send warnings or errors to the email address provided. Scheduled
tests are run after the default scheduled device polling, which by default
is every thirty minutes after the smartd service is started.
/dev/hda -d ata -S off -s S/../.././12 -m notifications@test.com -a
In Red Hat Enterprise Linux 4 type the following.
# sudo cp /usr/share/doc/smartmontools-*/smartd.conf /etc/smartd.conf
# sudo cp /etc/smartd.conf /etc/smartd.conf.example
# sudo vi /etc/smartd.conf
In Red Hat Enterprise Linux 5 type the following.
# rpm -ql smartmontools-* | grep smartd.conf
/usr/sbin/smartd-conf.py
/usr/sbin/smartd-conf.pyc
/usr/sbin/smartd-conf.pyo
/usr/share/doc/smartmontools-*/smartd.conf
/usr/share/man/man5/smartd.conf.5.gz
# sudo cp /usr/share/doc/smartmontools-*/smartd.conf /etc/smartd.conf
# sudo cp /etc/smartd.conf /etc/smartd.conf.example
# sudo vi /etc/smartd.conf
You will need to configure SELinux appropriately. SELinux status can be
found by running sestatus.
# sudo /usr/sbin/sestatus | grep status:
SELinux status: enabled
Start the smartmontools service.
# sudo /sbin/service smartd start
Starting smartd: [ OK ]
# sudo cat /var/run/smartd.pid
3365
5 - Smartctl examples
Here are some basic examples of things you can find with smartctl. This
command enables SMART on the hard disk.
# sudo /usr/sbin/smartctl -d ata /dev/hda -s on
smartctl version 5.36 [i686-redhat-linux-gnu] Copyright (C) 2002-6 Bruce Allen
Home page is http://smartmontools.sourceforge.net/
=== START OF ENABLE/DISABLE COMMANDS SECTION ===
SMART Enabled.
This command prints the device model number, serial number, firmware version,
and ATA Standard version/revision information.
# sudo /usr/sbin/smartctl -d ata /dev/hda -i
smartctl version 5.36 [i686-redhat-linux-gnu] Copyright (C) 2002-6 Bruce Allen
Home page is http://smartmontools.sourceforge.net/
=== START OF INFORMATION SECTION ===
Model Family: Maxtor DiamondMax Plus 8 family
Device Model: Maxtor 6E040L0
Serial Number: E1MJ8Y2E
Firmware Version: NAR61590
User Capacity: 41,110,142,976 bytes
Device is: In smartctl database [for details use: -P show]
ATA Version is: 7
ATA Standard is: ATA/ATAPI-7 T13 1532D revision 0
Local Time is: Wed Nov 5 09:49:13 2008 CST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
This command prints the SMART health status.
# sudo /usr/sbin/smartctl -d ata /dev/hda -H
smartctl version 5.36 [i686-redhat-linux-gnu] Copyright (C) 2002-6 Bruce Allen
Home page is http://smartmontools.sourceforge.net/
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
This command runs a SMART short self test.
# sudo /usr/sbin/smartctl -d ata /dev/hda -t short
smartctl version 5.36 [i686-redhat-linux-gnu] Copyright (C) 2002-6 Bruce Allen
Home page is http://smartmontools.sourceforge.net/
=== START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION ===
Sending command: "Execute SMART Short self-test routine immediately in off-line mode".
Drive command "Execute SMART Short self-test routine immediately in off-line mode" successful.
Testing has begun.
Please wait 2 minutes for test to complete.
Test will complete after Wed Nov 5 09:55:15 2008
Use smartctl -X to abort test.
This command lists the log of selftest results.
# sudo /usr/sbin/smartctl -d ata /dev/hda -l selftest
smartctl version 5.36 [i686-redhat-linux-gnu] Copyright (C) 2002-6 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% 19486 -
# 2 Short offline Completed without error 00% 0 -
6 - Service check
Reboot your computer. Log in like normal and check to see that the
smartmontools service is running. That's it, now you have smartmontools
running in Red Hat Enterprise Linux.
# sudo /sbin/shutdown -r now
# sudo /sbin/service smartd status
smartd (pid 2013) is running...
|