Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a server with three identical SATA/600 3TB drives: /dev/sda, /dev/sdb, /dev/sdc. The drives are partitioned, using GPT with three partitions each:

  • 1 MB: Reserved partition for boot loader
  • 1 GB: RAID1 /dev/md0 ( ext2 ( /boot ) )
  • 3 TB: RAID1 /dev/md1 ( encrypted volume ( LVM ( volume group ( Swap, /, /etc, /home ... ) ) ) )

One of the three drives is a hot spare and the other two are active in the RAID sets. It works fine and I am able to boot after disconnecting any single HDD. I want to use smartd (part of smartmontools) to monitor the health of the drives and report errors to syslog (which I monitor using logcheck). This server should have as high availability as possible, but it is acceptable that performance is lowered during tests.

Here is the output of smartctl -a /dev/sda:

smartctl 5.41 2011-06-09 r3365 [x86_64-linux-3.2.0-4-amd64] (local build)
Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF INFORMATION SECTION ===
Device Model:     WDC WD30EZRX-00MMMB0
Serial Number:    WD-WMAWZ0412093
LU WWN Device Id: 5 0014ee 2b19fbdcd
Firmware Version: 80.00A80
User Capacity:    3,000,592,982,016 bytes [3.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   8
ATA Standard is:  Exact ATA specification draft version not indicated
Local Time is:    Fri Sep 27 15:37:25 2013 CEST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

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

General SMART Values:
Offline data collection status:  (0x82) Offline data collection activity
                    was completed without error.
                    Auto Offline Data Collection: Enabled.
Self-test execution status:      (   0) The previous self-test routine completed
                    without error or no self-test has ever 
                    been run.
Total time to complete Offline 
data collection:        (50280) seconds.
Offline data collection
capabilities:            (0x7b) SMART execute Offline immediate.
                    Auto Offline data collection on/off support.
                    Suspend Offline collection upon new
                    command.
                    Offline surface scan supported.
                    Self-test supported.
                    Conveyance Self-test supported.
                    Selective Self-test supported.
SMART capabilities:            (0x0003) Saves SMART data before entering
                    power-saving mode.
                    Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
                    General Purpose Logging supported.
Short self-test routine 
recommended polling time:    (   2) minutes.
Extended self-test routine
recommended polling time:    ( 255) minutes.
Conveyance self-test routine
recommended polling time:    (   5) minutes.
SCT capabilities:          (0x3035) SCT Status supported.
                    SCT Feature Control supported.
                    SCT Data Table supported.

SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x002f   200   200   051    Pre-fail  Always       -       0
  3 Spin_Up_Time            0x0027   148   148   021    Pre-fail  Always       -       9575
  4 Start_Stop_Count        0x0032   100   100   000    Old_age   Always       -       95
  5 Reallocated_Sector_Ct   0x0033   200   200   140    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x002e   200   200   000    Old_age   Always       -       0
  9 Power_On_Hours          0x0032   099   099   000    Old_age   Always       -       820
 10 Spin_Retry_Count        0x0032   100   253   000    Old_age   Always       -       0
 11 Calibration_Retry_Count 0x0032   100   253   000    Old_age   Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       93
192 Power-Off_Retract_Count 0x0032   200   200   000    Old_age   Always       -       65
193 Load_Cycle_Count        0x0032   196   196   000    Old_age   Always       -       12824
194 Temperature_Celsius     0x0022   119   116   000    Old_age   Always       -       33
196 Reallocated_Event_Count 0x0032   200   200   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0032   200   200   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0030   200   200   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x0032   200   200   000    Old_age   Always       -       0
200 Multi_Zone_Error_Rate   0x0008   200   200   000    Old_age   Offline      -       0

SMART Error Log Version: 1
No Errors Logged

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%       787         -
# 2  Extended offline    Completed without error       00%       727         -

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

It seems offline testing is supported. When I issue smartctl -o on, smartctl -c shows that Offline data collection status has been set to (0x82). If I issue smartctl -o off the same value becomes (0x02).

I have set up smartd to start up with the server by setting start_smartd=yes in /etc/default/smartmontools. How would you recommend that I configure smartd by editing /etc/smartd.conf for this server? Please describe each parameter you use and why you use it the way you do.

I will add my current set up as an answer. Feel free to use it as a base and improve it in your own answer. A better description using the same set up would be an improvement too!

share|improve this question
    
I can't post my answer yet, due to my low reputation (1). –  kyl Sep 27 '13 at 14:13
    
Hot spare with RAID 1 is weird, mdadm can easily span RAID 1 over three disks, providing real three way redundance and increased reading performance. –  frostschutz Sep 27 '13 at 14:42
    
I originally aimed to use RAID 5, which is the reason I bought three drives. But then I learned that the build in "fakeraid" is a bad option and I also learned that RAID 5 for my use case probably is a bad idea too. I don't think your suggestion is a good option as I think write performance will suffer (even more) with three active drives. And a hot spare isn't wierd, if a drive dies it will kick in, I find that useful. –  kyl Sep 28 '13 at 14:45
    
I'll wait a week or two and see which answer gets upvoted the most, as I'd like to take that in consideration when I mark my answer. –  kyl Sep 28 '13 at 14:46

4 Answers 4

We have configured all of our servers to run regular selftests with the following line in /etc/smartd.conf:

# DEVICESCAN matches all hard disks found in /dev/ and applies the following
# options to them.
#
# Default options from Debian:
# -d removable     don't exit when the device when a device vanishes
# -n standby       don't wake a device up that is sleeping
# -m root          send error reports to root
# -M exec ...      pipe the mail through that script
#
# Our options:
# -s L/../02/./17  run a long selftest on every 2nd of every month
#                  at 17 o'clock
DEVICESCAN -d removable -n standby -m root -M exec /usr/share/smartmontools/smartd-runner -s L/../02/./17

Selftests are IMO the most reliable kind of health check that SMART offers.


EDIT:

Could you please explain what -d removable does?

From man smartd.conf:

          removable - the device or its media is  removable.   This  indi‐
          cates  to  smartd  that  it should continue (instead of exiting,
          which is the default behavior) if the device does not appear  to
          be  present  when smartd is started.  This Directive may be used
          in conjunction with the other ´-d´ Directives.

I assume it prevents smartd from dying when one of the monitored disks vanishes...? I don't know for certain, I just added the -s L/../02/./17 part to that line. The original line:

DEVICESCAN -d removable -n standby -m root -M exec /usr/share/smartmontools/smartd-runner

is the default from Debian.

share|improve this answer
    
Could you please explain what -d removable does? I don't get it from the above description, nor from the explanation line in smartd.conf which simply says it Sets the device type: ata, scai, marvell, removable, 3ware, N, hpt, L/M/N –  kyl Sep 27 '13 at 14:18
    
@kyl I've updated my answer accordingly. –  Martin von Wittich Sep 27 '13 at 14:51

I usually use this simple check which is defined per drive and not globally per system (with DEVICESCAN option) - I'm interested in overall SMART health status and whether there are any pending sectors reallocation and any faulty sectors since last SMART test. Any suspicious events are mailed to my smart catch-all address then:

/dev/sda -H -C 0 -U 0 -m smart@domain.tld

On some systems, I have defined to run SMART self-tests on specific dates automatically. This spec defines to run long test on two drives every Sunday after midnight (but not at the same times - between midnight and 1am and then from 2am):

/dev/sda -a -s L/../../7/00 -m smart@domain.tld
/dev/sdb -a -s L/../../7/02 -m smart@domain.tld
share|improve this answer

I switched from long selftests to select,cont tests. It's like the long selftest, but only one slice of disk at a time. So while the long selftest may take well over a day (with an otherwise busy 3TB disk), the selective test can run every night when the server is the least busy and actually finish, without harming performance in the more busy hours.

So basically you would be distributing a monthly long self-test of the entire disk, to a nightly selective test that still covers the entire disk over the course of a month.

It takes some preparation though.

  • smartd must run with the --savestates option as the disks themselves usually do not keep track of the last region tested.
  • You must initiate the first selective self test manually (-t select,0-$size) so smartd will know the slice size to test each day. The size determines how long the test will take and how many days to span the entire disk.
  • Make sure the $size you pick aligns to the disk size. Otherwise you risk the last slice being very small (worst case you waste a day testing only a single sector of the disk).
  • You must verify that this information actually made it to the savestates files as sometimes it does not and then the test will not run the way you want to. (Editing the savestate file directly is also an option).
  • The syntax for the smartd.conf file is -s c/../.././01 (in this example it would run every day at 1am).

Once that is done however the process is automatic and reliable. Once it reaches the end of the disk it will automatically start at the beginning the next day. Read the smartctl manpage regarding select,cont tests.

While the long or selective tests are great, you should probably still run the short or overall assessment tests. They only take a very short time and may help detect general problems.

share|improve this answer
    
I like your idea with select,cont tests. I'll have to dig a bit deper into those. SMART reports that my long self test will take 14 hours, and that's without any load at all on the disk. –  kyl Sep 28 '13 at 14:47
up vote 0 down vote accepted
# DEVICESCAN      For all disks with SMART capabilities.
#
# -o off          Turn off automatic running of offline tests. An offline test
#                 is a test which may degrade performance.
#
# -n standby      Do not spin up the disk for the periodic 30 minute (default)
#                 SMART status polling, instead wait until the disk is active
#                 again and poll it then.
#
# -W 2            Report temperature changes of at least 2 degrees celsius since
#                 the last reading. Also report if a new min/max temperature is
#                 detected.
#
# -S on           Auto save attributes such as how long the disk has been powered
#                 on, min and max disk temperature.
#
# -s (L/../.[02468]/1/04|S/../.[13579]/1/04)
#     '-------a--------' '--------b-------'
#
#                 a: Long test on    even monday mornings at 04:00
#                 b: Short test on uneven monday mornings at 04:00

DEVICESCAN -o off -n standby -W 2 -S on -s (L/../.[02468]/1/04|S/../.[13579]/1/04)
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.