고가용성 소프트웨어 RAID 1 서버에서 smartd(smartmontools의)를 사용하여 디스크 상태 모니터링

고가용성 소프트웨어 RAID 1 서버에서 smartd(smartmontools의)를 사용하여 디스크 상태 모니터링

/dev/sda3개의 동일한 SATA/600 3TB 드라이브( , /dev/sdb, )가 있는 서버가 있습니다 /dev/sdc. 드라이브는 각각 세 개의 파티션이 있는 GPT를 사용하여 파티셔닝됩니다.

  • 1MB: 부트로더용으로 예약된 파티션
  • 1GB: RAID1 /dev/md0( ext2( /boot ) )
  • 3TB: RAID1 /dev/md1 ( 암호화된 볼륨( LVM ( 볼륨 그룹( 스왑, /, /etc, /home ... ) ) ) )

세 개의 드라이브 중 하나는 핫 스페어이고 나머지 두 개는 RAID 세트에서 활성 상태입니다. 제대로 작동하며 단일 HDD를 분리한 후 부팅할 수 있습니다. 나는 사용하고 싶다smartd (smartmontools의 일부)드라이브 상태를 모니터링하고 syslog에 오류를 보고합니다(저는 다음을 사용하여 모니터링합니다).로그체크). 이 서버는 최대한 가용성이 높아야 하지만, 테스트 중에 성능이 저하되는 것은 허용됩니다.

출력은 다음과 같습니다 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.

오프라인 테스트가 지원되는 것 같습니다. 을 발행하면 smartctl -o on으로 설정된 smartctl -c것으로 표시됩니다 . 발행하면 동일한 값이 됩니다 .Offline data collection status(0x82)smartctl -o off(0x02)

start_smartd=yes에서 설정하여 서버를 시작하도록 smartd를 설정했습니다 /etc/default/smartmontools. /etc/smartd.conf이 서버에 대해 편집하여 smartd를 구성하는 것을 어떻게 권장하시겠습니까 ? 사용하는 각 매개변수와 해당 매개변수를 현재 방식으로 사용하는 이유를 설명하세요.

현재 설정을 답변으로 추가하겠습니다. 자유롭게 이를 기반으로 사용하고 자신의 답변으로 개선하십시오. 동일한 설정을 사용하는 더 나은 설명도 개선이 될 것입니다!

답변1

긴 자체 테스트에서 테스트로 전환했습니다 select,cont. 긴 자체 테스트와 비슷하지만 한 번에 하나의 디스크 조각만 가능합니다. 따라서 긴 자체 테스트는 하루 이상 걸릴 수 있지만(3TB 디스크 사용 시) 선택적 테스트는 서버가 가장 덜 바쁜 시간에 성능을 저하시키지 않고 매일 밤 실행될 수 있습니다.

따라서 기본적으로 전체 디스크에 대한 월간 자체 테스트를 배포하고, 한 달 동안 전체 디스크를 다루는 야간 선택적 테스트를 배포하게 됩니다.

그래도 약간의 준비가 필요합니다.

  • smartd--savestates디스크 자체는 일반적으로 테스트된 마지막 영역을 추적하지 않으므로 옵션을 사용하여 실행해야 합니다 .
  • 첫 번째 선택적 자체 테스트를 수동으로 시작해야( -t select,0-$size) smartd매일 테스트할 슬라이스 크기를 알 수 있습니다. 크기에 따라 테스트에 소요되는 시간과 전체 디스크에 적용되는 데 소요되는 일수가 결정됩니다.
  • 선택한 $size가 디스크 크기와 일치하는지 확인하세요. 그렇지 않으면 마지막 슬라이스가 매우 작아질 위험이 있습니다(최악의 경우 디스크의 단일 섹터만 테스트하는 데 하루를 낭비하게 됩니다).
  • 때로는 그렇지 않은 경우가 있기 때문에 이 정보가 실제로 savestates 파일에 반영되었는지 확인해야 합니다. 그러면 테스트가 원하는 방식으로 실행되지 않습니다. (savestate 파일을 직접 편집하는 것도 옵션입니다).
  • 파일 의 구문은 smartd.conf다음과 같습니다 -s c/../.././01(이 예에서는 매일 오전 1시에 실행됩니다).

그러나 일단 완료되면 프로세스는 자동으로 이루어지며 신뢰할 수 있습니다. 디스크 끝에 도달하면 다음 날 처음부터 자동으로 시작됩니다. 테스트 smartctl에 관한 맨페이지를 읽어보세요 select,cont.

장기 또는 선택적 테스트도 훌륭하지만 단기 또는 전체 평가 테스트도 실행해야 합니다. 시간이 매우 짧으며 일반적인 문제를 감지하는 데 도움이 될 수 있습니다.

답변2

우리는 다음 줄을 사용하여 정기적인 자체 테스트를 실행하도록 모든 서버를 구성했습니다 /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

자체 테스트는 SMART가 제공하는 가장 신뢰할 수 있는 종류의 상태 확인입니다.


편집하다:

무엇을 하는지 설명해 주시겠어요 -d removable?

에서 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.

smartd모니터링되는 디스크 중 하나가 사라질 때 죽는 것을 방지한다고 가정합니다 ...? 확실하지는 않습니다. 방금 -s L/../02/./17해당 줄에 해당 부분을 추가했습니다. 원래 줄:

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

데비안의 기본값입니다.

답변3

# 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)

답변4

나는 일반적으로 시스템별로 전역적으로 정의되지 않고( DEVICESCAN옵션 포함) 드라이브별로 정의되는 이 간단한 검사를 사용합니다. 전반적인 SMART 상태와 마지막 SMART 테스트 이후 보류 중인 섹터 재할당 및 결함이 있는 섹터가 있는지 여부에 관심이 있습니다. 의심스러운 이벤트는 내 스마트 포괄 주소로 발송됩니다.

/dev/sda -H -C 0 -U 0 -m [email protected]

일부 시스템에서는 특정 날짜에 SMART 자체 테스트를 자동으로 실행하도록 정의했습니다. 이 사양은 매주 일요일 자정 이후 두 개의 드라이브에서 장기 테스트를 실행하도록 정의합니다(그러나 동시에는 아닙니다. 자정부터 오전 1시 사이, 그리고 오전 2시부터).

/dev/sda -a -s L/../../7/00 -m [email protected]
/dev/sdb -a -s L/../../7/02 -m [email protected]

관련 정보