Last modified: Jan. 30, 2010
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 MythDora. Smartmontools
can run tests to monitor the SMART of hard disks. This has been tested in
MythDora 10.21.
2 - Dependencies
Install the msmtp package. Msmtp is an SMTP client used to send email. We will
use it to send email notifications.
# sudo yum -y install msmtp
[sudo] password for user:
It's helpful to know what type of hard disks the computer has. You can find
this out by typing the following.
# sudo parted -l | grep Disk | grep -v mapper
[sudo] password for user:
Disk /dev/sda: 2000GB
Disk /dev/sdb: 3000GB
In this case there are two hard drives. Get more information about the hard
disks by typing the following.
# dmesg | grep -e "\[sda]" -e "\[sdb]" | uniq
sd 6:0:0:0: [sda] 3906207744 512-byte hardware sectors (1999978 MB)
sd 6:0:0:0: [sda] Write Protect is off
sd 6:0:0:0: [sda] Mode Sense: 23 00 00 00
sd 6:0:0:0: [sda] Write cache: enabled, read cache: disabled, doesn't support DPO or FUA
sd 6:0:0:0: [sda] Attached SCSI disk
sd 6:0:1:0: [sdb] Very big device. Trying to use READ CAPACITY(16).
sd 6:0:1:0: [sdb] 5859311616 512-byte hardware sectors (2999968 MB)
sd 6:0:1:0: [sdb] Write Protect is off
sd 6:0:1:0: [sdb] Mode Sense: 23 00 00 00
sd 6:0:1:0: [sdb] Write cache: enabled, read cache: disabled, doesn't support DPO or FUA
sd 6:0:1:0: [sdb] Attached SCSI disk
# dmesg | grep -i scsi | grep -e "6:0:0:0:" -e "6:0:1:0:"
scsi 6:0:0:0: Direct-Access AMCC 9500S-8 DISK 2.08 PQ: 0 ANSI: 3
scsi 6:0:1:0: Direct-Access AMCC 9500S-8 DISK 2.08 PQ: 0 ANSI: 3
sd 6:0:0:0: [sda] Attached SCSI disk
sd 6:0:0:0: Attached scsi generic sg1 type 0
sd 6:0:1:0: [sdb] Attached SCSI disk
sd 6:0:1:0: Attached scsi generic sg2 type 0
The sda and sdb disks are on a 3ware 9500S-8 controller card which is a SATA
RAID card meaning that there are multiple hard disks connected to it in a RAID
configuration.
# dmesg | grep -i 3ware | uniq
3ware 9000 Storage Controller device driver for Linux v2.26.02.011.
scsi6 : 3ware 9000 Storage Controller
3w-9xxx: scsi6: Found a 3ware 9000 Storage Controller at 0xfebffc00, IRQ: 16.
Install the wget package.
# sudo yum -y install wget
[sudo] password for user:
The tw_cli software from 3ware has to be installed in order to get information
about the hard disks. The package can be downloaded at http://www.atrpms.net/.
# cd ~
# wget http://dl.atrpms.net/all/tw_cli-$ver.$arch.rpm
# sudo rpm -ivh tw_cli-*.rpm
[sudo] password for user:
Get more information about the hard disks attached to the 3ware controller by
typing the following. Since the hard disks are identical we will get the model
number of just one of them.
# sudo tw_cli
[sudo] password for user:
//server> info
Ctl Model Ports Drives Units NotOpt RRate VRate BBU
------------------------------------------------------------------------
c6 9500S-8 8 6 2 0 4 4 -
//server> info c6
Unit UnitType Status %Cmpl Stripe Size(GB) Cache AVerify IgnECC
------------------------------------------------------------------------------
u0 RAID-0 OK - 64K 1862.62 ON OFF -
u1 RAID-5 OK - 64K 2793.94 ON OFF OFF
Port Status Unit Size Blocks Serial
---------------------------------------------------------------
p0 OK u0 931.51 GB 1953525168 6VP2C06R
p1 OK u0 931.51 GB 1953525168 5VP1YJQH
p2 OK u1 931.51 GB 1953525168 6VP20EP1
p3 OK u1 931.51 GB 1953525168 5VP1YBR9
p4 OK u1 931.51 GB 1953525168 5VP1YBVN
p5 OK u1 931.51 GB 1953525168 6VP256AZ
p6 NOT-PRESENT - - - -
p7 NOT-PRESENT - - - -
//server> info c6 p0 model
/c6/p0 Model = ST31000528AS
//server> quit
Now, with the model of the hard drives find out if they are ATA, SCSI or SAT.
Since some hard disks are attached to a 3ware SATA RAID controller, there is
also software from 3ware to view information via a website interface. Install
the 3dm2 package. The package can be downloaded at http://www.atrpms.net/.
# cd ~
# wget http://dl.atrpms.net/all/3dm2-$ver.at.$arch.rpm
# sudo rpm -ivh 3dm2-*.rpm
[sudo] password for user:
Enable the 3dm2 service so that it will start when the system starts up.
# sudo chkconfig 3dm2 on
[sudo] password for user:
# sudo chkconfig --list 3dm2
[sudo] password for user:
3dm2 0:off 1:off 2:off 3:on 4:on 5:on 6:off
Start the 3dm2 service.
# sudo service 3dm2 start
[sudo] password for user:
Starting 3ware DiskSwitch daemon: [ OK ]
# sudo service 3dm2 status
[sudo] password for user:
3dm2 (pid 23177 23176 23174) is running...
3 - Smartmontools installation
Install the smartmontools package.
# sudo yum -y install smartmontools
[sudo] password for user:
4 - Service configuration
Find where the smartmontools daemon was installed to.
# rpm -qa | grep smartmontools
smartmontools-*
# rpm -ql smartmontools-* | grep sbin
/usr/sbin/smartctl
/usr/sbin/smartd
Edit the init.d script to have the following.
smartd_opts="-p /var/run/smartd.pid -q never"
# sudo vi /etc/sysconfig/smartmontools
[sudo] password for user:
Enable the smartmontools service so that it will start when the system
starts up.
# sudo chkconfig smartd on
[sudo] password for user:
# sudo chkconfig --list smartd
[sudo] password for user:
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
# 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
You can create your own configuration file. Here is a simple example. This
will disable Autosave and will schedule a short self-test between 8-9 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/twa0 -d 3ware,0 -S off -s S/../.././20 -m notifications@test.com -a
/dev/twa0 -d 3ware,1 -S off -s S/../.././20 -m notifications@test.com -a
/dev/twa0 -d 3ware,2 -S off -s S/../.././20 -m notifications@test.com -a
/dev/twa0 -d 3ware,3 -S off -s S/../.././20 -m notifications@test.com -a
/dev/twa0 -d 3ware,4 -S off -s S/../.././20 -m notifications@test.com -a
/dev/twa0 -d 3ware,5 -S off -s S/../.././20 -m notifications@test.com -a
# rpm -ql smartmontools-* | grep smartd.conf
/etc/smartd.conf
/usr/share/doc/smartmontools-*/smartd.conf
/usr/share/man/man5/smartd.conf.5.gz
# sudo cp /etc/smartd.conf /etc/smartd.conf.example
[sudo] password for user:
# sudo vi /etc/smartd.conf
[sudo] password for user:
Start the smartmontools service.
# sudo service smartd start
[sudo] password for user:
Starting smartd: [ OK ]
# sudo service smartd status
[sudo] password for user:
smartd (pid 12549) is running...
5 - Smartctl examples
Here are some basic examples of things you can find with smartctl. This
command enables SMART on the hard disks.
# sudo smartctl -d 3ware,0 /dev/twa0 -s on
[sudo] password for user:
smartctl version 5.38 [i386-redhat-linux-gnu] Copyright (C) 2002-8 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 smartctl -d 3ware,0 /dev/twa0 -i
[sudo] password for user:
smartctl version 5.38 [i386-redhat-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/
=== START OF INFORMATION SECTION ===
Device Model: ST31000528AS
Serial Number: 6VP2C06R
Firmware Version: CC38
User Capacity: 1,000,204,886,016 bytes
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: 8
ATA Standard is: ATA-8-ACS revision 4
Local Time is: Sat Jan 30 08:09:56 2010 CST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
This command prints the SMART health status.
# sudo smartctl -d 3ware,0 /dev/twa0 -H
[sudo] password for user:
smartctl version 5.38 [i386-redhat-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
This command runs a SMART short self test.
# sudo smartctl -d 3ware,0 /dev/twa0 -t short
[sudo] password for user:
smartctl version 5.38 [i386-redhat-linux-gnu] Copyright (C) 2002-8 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 1 minutes for test to complete.
Test will complete after Sat Jan 30 08:11:18 2010
Use smartctl -X to abort test.
This command lists the log of selftest results.
# sudo smartctl -d 3ware,0 /dev/twa0 -l selftest
[sudo] password for user:
smartctl version 5.38 [i386-redhat-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% 343 -
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 MythDora.
# sudo shutdown -r now
[sudo] password for user:
# sudo service 3dm2 status
[sudo] password for user:
3dm2 (pid 2382 2380 2247) is running...
# sudo service smartd status
[sudo] password for user:
smartd (pid 2510) is running...
|