Smartmontools: Ya Mon!

Last article we introduced the SMART capabilities of hard drives (who knew your drives were SMART?). In this article smartmontools, an application for examining the SMART attributes and trigger self tests, is examined.

As you might recall, SMART (Self-Monitoring, Analysis, and Reporting Technology) is a standard technology for storage devices to provide monitoring data about the device itself. However, the data, called the attributes, is not standard and varies from drive to drive and from manufacturer to manufacturer with values that are defined by the manufacturer. In general the attributes include such information as the temperature of the drive, the number of sectors that have gone bad, reallocation of bad sectors, and so on. In addition to attributes SMART can be used to force the drives to perform self-tests to check for problems and store the information in logs.

All of the features and capabilities of SMART drives sounds great but how does one collect SMART attribute information or control drive self-tests and obtain the logs? Linux has a great tool called smartmontools, that allows you to interact with the storage devices using the SMART protocol.

Smartmontools

There is an active open-source project to read the SMART information from hard drives under Linux (although it can be used by other operating systems). Smartmontools allows the user to control and monitor storage systems that are SMART capable. It is derived from an earlier project, smartsuite, from the University of California at Santa Cruz. It has expanded on the earlier work to add later standards and to add features to the tools. The tool is compatible with all SMART features and supports ATA/ATAPI/SATA-3 to -8 disks and SCSI disks and tape devices. It also supports the major Linux RAID cards which can sometimes give difficulties because they require vendor specific IO control commands. Check the smartmontools page for more details on your specific card.

Smartmontools is easy to build and easy to use. Let’s run through an example on the desktop system that I use for benchmarking.

The first step is to download the tar file and build it. This is covered in the smartmontool’s web page and is a straight forward process of “./configure; make; make install.” The resulting binaries are installed in /usr/local so be sure to adjust your $PATH accordingly. You should see two binaries in /usr/local/sbin: smartctl and smartd. Smartctl is the command we will be using most in this article since it’s the command line tool.

The first thing to do once smartmontools is built and installed is to scan each drive using the “-i” option (“info” option). The system I’m testing has 4 drives and the output from the “smartctl -i” option is shown below for each drive. Notice that the device path for each drive (e.g. /dev/hda) is used in the smartctl command. Be sure to replace this device path with whatever device you are examining.

[root@test64 laytonjb]# /usr/local/sbin/smartctl -i /dev/hda
smartctl 5.39.1 2010-01-28 r3054 [x86_64-unknown-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF INFORMATION SECTION ===
Model Family:     IBM Deskstar 40GV & 75GXP series (all other firmware)
Device Model:     IBM-DTLA-307020
Serial Number:    YHCYHT7C565
Firmware Version: TX3IA65A
User Capacity:    20,416,757,760 bytes
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   5
ATA Standard is:  ATA/ATAPI-5 T13 1321D revision 1
Local Time is:    Sat Apr 10 18:50:52 2010 EDT

==> WARNING: IBM Deskstar 40GV and 75GXP drives may need upgraded SMART firmware.
Please see http://www.geocities.com/dtla_update/ and

http://www.ibm.com/pc/support/site.wss/MIGR-42215.html

SMART support is: Available - device has SMART capability.
SMART support is: Enabled


I’ve ignored the warning since it’s a little old and this is a benchmark system. But notice the comment, “In smartctl database”. This informs us that this drive is in the smartctl database within smartmontools so the smart attribute values and what they mean are in the database. To check we just use the “-P show” option with smartctl.

[root@test64 SMARTMONTOOLS]# /usr/local/sbin/smartctl -P show /dev/hda
smartctl 5.39.1 2010-01-28 r3054 [x86_64-unknown-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

Drive found in smartmontools Database.  Drive identity strings:
MODEL:              IBM-DTLA-307020
FIRMWARE:           TX3IA65A
match smartmontools Drive Database entry:
MODEL REGEXP:       (IBM-)?DTLA-30[57]0[123467][05].*
FIRMWARE REGEXP:    .*
MODEL FAMILY:       IBM Deskstar 40GV & 75GXP series (all other firmware)
ATTRIBUTE OPTIONS:  None preset; no -v options are required.
WARNINGS:           IBM Deskstar 40GV and 75GXP drives may need upgraded SMART firmware.
Please see http://www.geocities.com/dtla_update/ and

http://www.ibm.com/pc/support/site.wss/MIGR-42215.html


Notice the comment about “match smartmontools” means the drive is in the database. After that comment the output from smartctl will present the summary information of the drive from the smartmontools database.

The second drive is /home and is a simple Seagate SATA drive that is a little on the older side.

[root@test64 laytonjb]# /usr/local/sbin/smartctl -i /dev/sda
smartctl 5.39.1 2010-01-28 r3054 [x86_64-unknown-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF INFORMATION SECTION ===
Model Family:     Seagate Barracuda 7200.7 and 7200.7 Plus family
Device Model:     ST3160827AS
Serial Number:    4MT03PK8
Firmware Version: 3.42
User Capacity:    160,041,885,696 bytes
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   6
ATA Standard is:  ATA/ATAPI-6 T13 1410D revision 2
Local Time is:    Sat Apr 10 18:51:33 2010 EDT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled


This drive is also in the smartctl database.

The next two drives are the same but I’ll show the smartctl output for both.

[root@test64 laytonjb]# /usr/local/sbin/smartctl -i /dev/sdb
smartctl 5.39.1 2010-01-28 r3054 [x86_64-unknown-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF INFORMATION SECTION ===
Model Family:     Seagate Barracuda 7200.11 family
Device Model:     ST3500320AS
Serial Number:    9QM5WJ21
Firmware Version: SD15
User Capacity:    500,107,862,016 bytes
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   8
ATA Standard is:  ATA-8-ACS revision 4
Local Time is:    Sat Apr 10 18:52:01 2010 EDT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled


[root@test64 laytonjb]# /usr/local/sbin/smartctl -i /dev/sdc
smartctl 5.39.1 2010-01-28 r3054 [x86_64-unknown-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF INFORMATION SECTION ===
Model Family:     Seagate Barracuda 7200.11 family
Device Model:     ST3500320AS
Serial Number:    9QM6A0SC
Firmware Version: SD15
User Capacity:    500,107,862,016 bytes
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   8
ATA Standard is:  ATA-8-ACS revision 4
Local Time is:    Sat Apr 10 18:52:19 2010 EDT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled


During the query of the drives you will see messages in /var/log/message. For example, the following is output when /dev/sda, /dev/sdb, and /dev/sdc were queried.

Apr 10 18:41:34 test64 smartd[3714]: Device /dev/sda: using '-d sat' for ATA disk behind SAT layer.
Apr 10 18:41:34 test64 smartd[3714]: Device: /dev/sda, opened
Apr 10 18:41:34 test64 smartd[3714]: Device: /dev/sda, found in smartd database.
Apr 10 18:41:34 test64 smartd[3714]: Device: /dev/sda, is SMART capable. Adding to "monitor" list.
Apr 10 18:41:34 test64 smartd[3714]: Device: /dev/sdb, opened
Apr 10 18:41:34 test64 smartd[3714]: Device /dev/sdb: using '-d sat' for ATA disk behind SAT layer.
Apr 10 18:41:34 test64 smartd[3714]: Device: /dev/sdb, opened
Apr 10 18:41:34 test64 smartd[3714]: Device: /dev/sdb, found in smartd database.
Apr 10 18:41:34 test64 smartd[3714]: Device: /dev/sdb, is SMART capable. Adding to "monitor" list.
Apr 10 18:41:34 test64 smartd[3714]: Device: /dev/sdc, opened
Apr 10 18:41:34 test64 smartd[3714]: Device /dev/sdc: using '-d sat' for ATA disk behind SAT layer.
Apr 10 18:41:34 test64 smartd[3714]: Device: /dev/sdc, opened
Apr 10 18:41:34 test64 smartd[3714]: Device: /dev/sdc, found in smartd database.
Apr 10 18:41:35 test64 smartd[3714]: Device: /dev/sdc, is SMART capable. Adding to "monitor" list.
Apr 10 18:41:35 test64 smartd[3714]: Monitoring 1 ATA and 3 SCSI devices
Apr 10 18:41:36 test64 smartd[3719]: smartd has fork()ed into background mode. New PID=3719.


The line that says “Adding to ‘monitor’ list” refers to the smart daemon that monitors the drives (smartd). We’ll talk more about smartd in a later article.

The next thing we should do is check the health of the devices. This is pretty simple using the “-H” option with smartctl. In this and subsequent examples, only /dev/sdb will be used for the sake of brevity.

[root@test64 laytonjb]# /usr/local/sbin/smartctl -H /dev/sdb
smartctl 5.39.1 2010-01-28 r3054 [x86_64-unknown-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

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


You can see that the drive passed the SMART health test (really this is the SMART status attribute of the drive). If you have a drive that didn’t pass, immediately back up that drive and pull it from service.

Now that we’ve scanned our storage devices and we know they are healthy let’s do something useful. In particular, let’s do the following:


  • Enable SMART permanently
  • Turn on offline data collection
  • Autosave device vendor-specific attributes through power cycles (so we don’t lose data between power cycles)

The smartctl command is, “smartctl -s on -o on -S on /dev/sdb”. I’m just using the /dev/sdb as an example (it would be the same for the other drives). The output from this command is,
[root@test64 laytonjb]# /usr/local/sbin/smartctl -s on -o on -S on /dev/sdb
smartctl 5.39.1 2010-01-28 r3054 [x86_64-unknown-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF ENABLE/DISABLE COMMANDS SECTION ===
SMART Enabled.
SMART Attribute Autosave Enabled.
SMART Automatic Offline Testing Enabled every four hours.

Comments on "Smartmontools: Ya Mon!"

Blog looks nice. I’m still trying to make a blog but it won’t be as professional as yours /: Keep on blogging :) pirater un compte facebook

Reply

Smartmontools: Ya Mon! | Linux Magazine
mnvcjfvzt http://www.g01065t8x5um1cj3vwep758b29bai9x9s.org/
[url=http://www.g01065t8x5um1cj3vwep758b29bai9x9s.org/]umnvcjfvzt[/url]
amnvcjfvzt

Reply

Spa won’t delay to find these types of in black colored!A birthday celebration set in 31 days to weeks nonetheless its in no way heading rapidly sufficiently!I just provide 824604.pink2.net all year long my mom suggests your sweetheart will never now how when i dont sauna and yet internet marketing obsessive about these individuals i did not become these kinds of kinds but still although i contain the black colored cardy and had all of them for pretty much each year painted these people water-resistant objects once a month after i got these plus they’re still for good a fit condition!!!These are generally super nice and everyone loves these individuals soo significantly!!!!!

Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>