大网数据广告活动
服务器运维问答

Can I make md (Linux software RAID) more fault tolerant?

· 52CE 我爱测

I have a particular hard drive in a RAID 1 mirror that gets failed out under heavy load, typically, when I run a full backup. There is nothing wrong with the drive. Ok, it is getting one error when writing the superblock, but tha…

问题原文

原帖链接 · Nick · CC BY-SA 4.0

I have a particular hard drive in a RAID 1 mirror that gets failed out under heavy load, typically, when I run a full backup.

There is nothing wrong with the drive. Ok, it is getting one error when writing the superblock, but that's it. It's always this same disk and this same array that needs manually re-added every time I run the backup process.

Are there any settings that will make md more tolerant of whatever is causing this drive to get failed when under load?

This is Linux software RAID on Debian.

UPDATE: As requested, DMSG output at the time of failure:

[2347429.116507] print_req_error: I/O error, dev sda, sector 15751347328
[2347429.116511] sd 1:0:0:0: [sda] tag#1058 FAILED Result: hostbyte=DID_SOFT_ERROR driverbyte=DRIVER_OK
[2347429.116516] mpt2sas_cm0: log_info(0x31080000): originator(PL), code(0x08), sub_code(0x0000)
[2347429.116518] sd 1:0:0:0: [sda] tag#1058 CDB: Write(16) 8a 08 00 00 00 00 00 00 00 28 00 00 00 08 00 00
[2347429.116522] mpt2sas_cm0: log_info(0x31080000): originator(PL), code(0x08), sub_code(0x0000)
[2347429.116523] print_req_error: I/O error, dev sda, sector 40
[2347429.116526] mpt2sas_cm0: log_info(0x31080000): originator(PL), code(0x08), sub_code(0x0000)
[2347429.116529] print_req_error: I/O error, dev sda, sector 40
[2347429.116532] mpt2sas_cm0: log_info(0x31080000): originator(PL), code(0x08), sub_code(0x0000)
[2347429.116533] md: super_written gets error=10
[2347429.116536] mpt2sas_cm0: log_info(0x31080000): originator(PL), code(0x08), sub_code(0x0000)
[2347429.116538] md/raid1:md127: Disk failure on sda, disabling device.
                 md/raid1:md127: Operation continuing on 1 devices.

I also just ran a short SMART offline test, which Completed without error. The status is:

SMART overall-health self-assessment test result: PASSED

UPDATE 2: output of smartctl -a /dev/sda

smartctl 6.6 2017-11-05 r4594 [x86_64-linux-4.19.0-25-amd64] (local build)
Copyright (C) 2002-17, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     HGST Ultrastar He10
Device Model:     HGST HUH721010ALE604
Serial Number:    1EK1W8WZ
LU WWN Device Id: 5 000cca 27eeb2150
Firmware Version: LHGNW384
User Capacity:    10,000,831,348,736 bytes [10.0 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    7200 rpm
Form Factor:      3.5 inches
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ACS-2, ATA8-ACS T13/1699-D revision 4
SATA Version is:  SATA 3.2, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Fri Nov 17 13:20:55 2023 EST
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:        (   93) seconds.
Offline data collection
capabilities:            (0x5b) SMART execute Offline immediate.
                    Auto Offline data collection on/off support.
                    Suspend Offline collection upon new
                    command.
                    Offline surface scan supported.
                    Self-test supported.
                    No 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:    (1167) minutes.
SCT capabilities:          (0x003d) SCT Status supported.
                    SCT Error Recovery Control 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     0x000b   100   100   016    Pre-fail  Always       -       0
  2 Throughput_Performance  0x0005   134   134   054    Pre-fail  Offline      -       96
  3 Spin_Up_Time            0x0007   151   151   024    Pre-fail  Always       -       429 (Average 442)
  4 Start_Stop_Count        0x0012   100   100   000    Old_age   Always       -       99
  5 Reallocated_Sector_Ct   0x0033   100   100   005    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x000b   100   100   067    Pre-fail  Always       -       0
  8 Seek_Time_Performance   0x0005   128   128   020    Pre-fail  Offline      -       18
  9 Power_On_Hours          0x0012   096   096   000    Old_age   Always       -       28468
 10 Spin_Retry_Count        0x0013   100   100   060    Pre-fail  Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       99
 22 Helium_Level            0x0023   100   100   025    Pre-fail  Always       -       100
192 Power-Off_Retract_Count 0x0032   099   099   000    Old_age   Always       -       1327
193 Load_Cycle_Count        0x0012   099   099   000    Old_age   Always       -       1327
194 Temperature_Celsius     0x0002   181   181   000    Old_age   Always       -       33 (Min/Max 17/45)
196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0022   100   100   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0008   100   100   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x000a   200   200   000    Old_age   Always       -       6783827

SMART Error Log Version: 1
ATA Error Count: 65535 (device log contains only the most recent five errors)
    CR = Command Register [HEX]
    FR = Features Register [HEX]
    SC = Sector Count Register [HEX]
    SN = Sector Number Register [HEX]
    CL = Cylinder Low Register [HEX]
    CH = Cylinder High Register [HEX]
    DH = Device/Head Register [HEX]
    DC = Device Command Register [HEX]
    ER = Error register [HEX]
    ST = Status register [HEX]
Powered_Up_Time is measured from power on, and printed as
DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes,
SS=sec, and sss=millisec. It "wraps" after 49.710 days.

Error 65535 occurred at disk power-on lifetime: 28414 hours (1183 days + 22 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  84 41 00 00 00 00 00  Error: ICRC, ABRT at LBA = 0x00000000 = 0

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  60 00 00 00 a1 db 40 00  14d+02:47:36.906  READ FPDMA QUEUED
  2f 00 01 10 00 00 00 00  14d+02:47:36.906  READ LOG EXT
  60 00 08 00 a2 db 40 00  14d+02:47:36.904  READ FPDMA QUEUED
  2f 00 01 10 00 00 00 00  14d+02:47:36.890  READ LOG EXT
  2f 00 01 10 00 00 00 00  14d+02:47:36.890  READ LOG EXT

Error 65534 occurred at disk power-on lifetime: 28414 hours (1183 days + 22 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  84 41 00 00 00 00 00  Error: ICRC, ABRT at LBA = 0x00000000 = 0

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  60 00 00 00 a1 db 40 00  14d+02:47:36.890  READ FPDMA QUEUED
  60 00 08 00 a2 db 40 00  14d+02:47:36.880  READ FPDMA QUEUED
  2f 00 01 10 00 00 00 00  14d+02:47:36.865  READ LOG EXT
  2f 00 01 10 00 00 00 00  14d+02:47:36.865  READ LOG EXT
  60 00 08 00 a2 db 40 00  14d+02:47:36.856  READ FPDMA QUEUED

Error 65533 occurred at disk power-on lifetime: 28414 hours (1183 days + 22 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  84 41 00 00 00 00 00  Error: ICRC, ABRT at LBA = 0x00000000 = 0

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  60 00 00 00 a1 db 40 00  14d+02:47:36.865  READ FPDMA QUEUED
  2f 00 01 10 00 00 00 00  14d+02:47:36.865  READ LOG EXT
  60 00 08 00 a2 db 40 00  14d+02:47:36.856  READ FPDMA QUEUED
  2f 00 01 10 00 00 00 00  14d+02:47:36.840  READ LOG EXT
  2f 00 01 10 00 00 00 00  14d+02:47:36.840  READ LOG EXT

Error 65532 occurred at disk power-on lifetime: 28414 hours (1183 days + 22 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  84 41 00 00 00 00 00  Error: ICRC, ABRT at LBA = 0x00000000 = 0

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  60 00 00 00 a1 db 40 00  14d+02:47:36.840  READ FPDMA QUEUED
  60 00 08 00 a2 db 40 00  14d+02:47:36.836  READ FPDMA QUEUED
  2f 00 01 10 00 00 00 00  14d+02:47:36.823  READ LOG EXT
  2f 00 01 10 00 00 00 00  14d+02:47:36.823  READ LOG EXT
  60 00 08 00 a2 db 40 00  14d+02:47:36.820  READ FPDMA QUEUED

Error 65531 occurred at disk power-on lifetime: 28414 hours (1183 days + 22 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  84 41 00 00 00 00 00  Error: ICRC, ABRT at LBA = 0x00000000 = 0

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  60 00 00 00 a1 db 40 00  14d+02:47:36.823  READ FPDMA QUEUED
  60 00 08 00 a2 db 40 00  14d+02:47:36.820  READ FPDMA QUEUED
  2f 00 01 10 00 00 00 00  14d+02:47:36.806  READ LOG EXT
  2f 00 01 10 00 00 00 00  14d+02:47:36.806  READ LOG EXT
  60 00 08 00 a2 db 40 00  14d+02:47:36.796  READ FPDMA QUEUED

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

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.

社区高分解答

原帖链接 · shodanshok · CC BY-SA 4.0

A single read-error will not kick-off the disk from the array, at least on post-2012 kernels.

From md man page:

In later kernels, a read-error will instead cause md to attempt a recovery by overwriting the bad block. i.e. it will find the correct data from elsewhere, write it over the block that failed, and then try to read it back again. If either the write or the re-read fail, md will treat the error the same way that a write error is treated, and will fail the whole device.

For the device to be remove from the array, one of these two things should happen:

  • a read error is followed by a write error for the affected sector
  • a link reset is issued by the kernel (you can find it via dmesg)

If you are sure the disk is OK, try re-seating it and/or change SATA/power cables.

If issues persist, replace it.

EDIT: your dmesg output clearly shows how sda has some serious problem. I would replace it as soon as possible.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2023-11-15)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。