如何对RAID阵列进行故障排除?


8

我今天早上刚检查了RAID阵列,得到的是:

$ cat /proc/mdstat
Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10] 
md1 : active raid1 sdc7[0]
      238340224 blocks [2/1] [U_]

md0 : active raid1 sdc6[0]
      244139648 blocks [2/1] [U_]

md127 : active raid1 sdc3[0]
      390628416 blocks [2/1] [U_]

unused devices: <none>
$

我相信这意味着我的阵列中的一个磁盘已死,这是真的吗?

我该如何进行正确的故障排除?我的/etc/mdadm/mdadm.conf样子是:

$ cat /etc/mdadm/mdadm.conf
# mdadm.conf
#
# Please refer to mdadm.conf(5) for information about this file.
#

# by default (built-in), scan all partitions (/proc/partitions) and all
# containers for MD superblocks. alternatively, specify devices to scan, using
# wildcards if desired.
#DEVICE partitions containers

# auto-create devices with Debian standard permissions
CREATE owner=root group=disk mode=0660 auto=yes

# automatically tag new arrays as belonging to the local system
HOMEHOST <system>

# instruct the monitoring daemon where to send mail alerts
MAILADDR root

# definitions of existing MD arrays
ARRAY /dev/md127 UUID=124cd4a5:2965955f:cd707cc0:bc3f8165
ARRAY /dev/md0 UUID=91e560f1:4e51d8eb:cd707cc0:bc3f8165
ARRAY /dev/md1 UUID=0abe503f:401d8d09:cd707cc0:bc3f8165

我如何找出哪个物理驱动器坏了并且需要更换?

谢谢

编辑1

# mdadm --detail /dev/md0
/dev/md0:
        Version : 0.90
  Creation Time : Tue Sep  1 19:15:33 2009
     Raid Level : raid1
     Array Size : 244139648 (232.83 GiB 250.00 GB)
  Used Dev Size : 244139648 (232.83 GiB 250.00 GB)
   Raid Devices : 2
  Total Devices : 1
Preferred Minor : 0
    Persistence : Superblock is persistent

    Update Time : Mon Sep 21 07:11:24 2015
          State : clean, degraded 
 Active Devices : 1
Working Devices : 1
 Failed Devices : 0
  Spare Devices : 0

           UUID : 91e560f1:4e51d8eb:cd707cc0:bc3f8165
         Events : 0.76017

    Number   Major   Minor   RaidDevice State
       0       8       38        0      active sync   /dev/sdc6
       1       0        0        1      removed
root@regDesktopHome:~# 

为什么会说呢Failed Devices : 0

EDIT2
打开Gparted,我可以同时查看/dev/sdb/dev/sdc,这是我的两个RAID驱动器。但是,mdadm认为/dev.sdb由于某种原因而被删除了……这很奇怪。我试图在``/ dev / sdb`上挂载一个分区,并得到以下内容

$sudo mount /dev/sdb7 test
[sudo] password for ron: 
mount: unknown filesystem type 'linux_raid_member'

看起来都很漂亮 如何恢复我的RAID阵列?

编辑3

我跑smartctl -a /dev/sdcsmartctl -a /dev/sdb,我也没有badblocks /dev/sdcbadblocks /dev/sdb同时sdc似乎100%干净,sdb恢复了一些坏块:

# badblocks /dev/sdb
16130668
16130669
16130670
16130671

这可能是我所看到的错误的原因吗?有什么方法可以修复/忽略这些坏块,还是应该更换驱动器?

编辑4

# smartctl --all /dev/sdb
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.13.0-62-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Seagate Barracuda 7200.12
Device Model:     ST31000528AS
Serial Number:    6VP0308B
LU WWN Device Id: 5 000c50 013d3ae45
Firmware Version: CC34
User Capacity:    1,000,204,886,016 bytes [1.00 TB]
Sector Size:      512 bytes logical/physical
Rotation Rate:    7200 rpm
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ATA8-ACS T13/1699-D revision 4
SATA Version is:  SATA 2.6, 3.0 Gb/s
Local Time is:    Sat Sep 26 11:35:02 2015 PDT

==> WARNING: A firmware update for this drive may be available,
see the following Seagate web pages:
http://knowledge.seagate.com/articles/en_US/FAQ/207931en
http://knowledge.seagate.com/articles/en_US/FAQ/213891en

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:                (  600) 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:        (   1) minutes.
Extended self-test routine
recommended polling time:        ( 195) minutes.
Conveyance self-test routine
recommended polling time:        (   2) minutes.
SCT capabilities:              (0x103f) SCT Status supported.
                                        SCT Error Recovery Control supported.
                                        SCT Feature Control supported.
                                        SCT Data Table supported.

SMART Attributes Data Structure revision number: 10
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000f   114   099   006    Pre-fail  Always       -       78420742
  3 Spin_Up_Time            0x0003   095   095   000    Pre-fail  Always       -       0
  4 Start_Stop_Count        0x0032   099   099   020    Old_age   Always       -       1240
  5 Reallocated_Sector_Ct   0x0033   099   099   036    Pre-fail  Always       -       60
  7 Seek_Error_Rate         0x000f   082   060   030    Pre-fail  Always       -       199357441
  9 Power_On_Hours          0x0032   052   052   000    Old_age   Always       -       42401
 10 Spin_Retry_Count        0x0013   100   100   097    Pre-fail  Always       -       0
 12 Power_Cycle_Count       0x0032   099   037   020    Old_age   Always       -       1240
183 Runtime_Bad_Block       0x0000   098   098   000    Old_age   Offline      -       2
184 End-to-End_Error        0x0032   100   100   099    Old_age   Always       -       0
187 Reported_Uncorrect      0x0032   094   094   000    Old_age   Always       -       6
188 Command_Timeout         0x0032   100   100   000    Old_age   Always       -       0
189 High_Fly_Writes         0x003a   050   050   000    Old_age   Always       -       50
190 Airflow_Temperature_Cel 0x0022   062   046   045    Old_age   Always       -       38 (Min/Max 30/38)
194 Temperature_Celsius     0x0022   038   054   000    Old_age   Always       -       38 (0 17 0 0 0)
195 Hardware_ECC_Recovered  0x001a   030   012   000    Old_age   Always       -       78420742
197 Current_Pending_Sector  0x0012   100   100   000    Old_age   Always       -       1
198 Offline_Uncorrectable   0x0010   100   100   000    Old_age   Offline      -       1
199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -       0
240 Head_Flying_Hours       0x0000   100   253   000    Old_age   Offline      -       73332271657814
241 Total_LBAs_Written      0x0000   100   253   000    Old_age   Offline      -       2822963046
242 Total_LBAs_Read         0x0000   100   253   000    Old_age   Offline      -       2361465529

SMART Error Log Version: 1
ATA Error Count: 6 (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 6 occurred at disk power-on lifetime: 42372 hours (1765 days + 12 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
  -- -- -- -- -- -- --
  40 51 00 d9 44 ec 01  Error: UNC at LBA = 0x01ec44d9 = 32261337

  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 08 d8 44 ec 41 00      09:26:28.967  READ FPDMA QUEUED
  27 00 00 00 00 00 e0 00      09:26:28.941  READ NATIVE MAX ADDRESS EXT [OBS-ACS-3]
  ec 00 00 00 00 00 a0 00      09:26:28.940  IDENTIFY DEVICE
  ef 03 46 00 00 00 a0 00      09:26:28.928  SET FEATURES [Set transfer mode]
  27 00 00 00 00 00 e0 00      09:26:28.901  READ NATIVE MAX ADDRESS EXT [OBS-ACS-3]

Error 5 occurred at disk power-on lifetime: 42372 hours (1765 days + 12 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
  -- -- -- -- -- -- --
  40 51 00 d9 44 ec 01  Error: UNC at LBA = 0x01ec44d9 = 32261337

  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 08 d8 44 ec 41 00      09:26:26.095  READ FPDMA QUEUED
  27 00 00 00 00 00 e0 00      09:26:26.069  READ NATIVE MAX ADDRESS EXT [OBS-ACS-3]
  ec 00 00 00 00 00 a0 00      09:26:26.068  IDENTIFY DEVICE
  ef 03 46 00 00 00 a0 00      09:26:26.055  SET FEATURES [Set transfer mode]
  27 00 00 00 00 00 e0 00      09:26:26.029  READ NATIVE MAX ADDRESS EXT [OBS-ACS-3]

Error 4 occurred at disk power-on lifetime: 42372 hours (1765 days + 12 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
  -- -- -- -- -- -- --
  40 51 00 d9 44 ec 01  Error: UNC at LBA = 0x01ec44d9 = 32261337

  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 08 d8 44 ec 41 00      09:26:23.222  READ FPDMA QUEUED
  27 00 00 00 00 00 e0 00      09:26:23.195  READ NATIVE MAX ADDRESS EXT [OBS-ACS-3]
  ec 00 00 00 00 00 a0 00      09:26:23.194  IDENTIFY DEVICE
  ef 03 46 00 00 00 a0 00      09:26:23.182  SET FEATURES [Set transfer mode]
  27 00 00 00 00 00 e0 00      09:26:23.137  READ NATIVE MAX ADDRESS EXT [OBS-ACS-3]

Error 3 occurred at disk power-on lifetime: 42372 hours (1765 days + 12 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
  -- -- -- -- -- -- --
  40 51 00 d9 44 ec 01  Error: UNC at LBA = 0x01ec44d9 = 32261337

  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 08 d8 44 ec 41 00      09:26:20.351  READ FPDMA QUEUED
  60 00 80 e8 44 ec 41 00      09:26:20.350  READ FPDMA QUEUED
  27 00 00 00 00 00 e0 00      09:26:20.324  READ NATIVE MAX ADDRESS EXT [OBS-ACS-3]
  ec 00 00 00 00 00 a0 00      09:26:20.323  IDENTIFY DEVICE
  ef 03 46 00 00 00 a0 00      09:26:20.311  SET FEATURES [Set transfer mode]

Error 2 occurred at disk power-on lifetime: 42372 hours (1765 days + 12 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
  -- -- -- -- -- -- --
  40 51 00 d9 44 ec 01  Error: UNC at LBA = 0x01ec44d9 = 32261337

  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 80 e8 44 ec 41 00      09:26:17.478  READ FPDMA QUEUED
  60 00 40 a8 44 ec 41 00      09:26:17.478  READ FPDMA QUEUED
  60 00 20 88 44 ec 41 00      09:26:17.476  READ FPDMA QUEUED
  60 00 08 80 44 ec 41 00      09:26:17.453  READ FPDMA QUEUED
  27 00 00 00 00 00 e0 00      09:26:17.427  READ NATIVE MAX ADDRESS EXT [OBS-ACS-3]

SMART Self-test log structure revision number 1
No self-tests have been logged.  [To run self-tests, use: smartctl -t]


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.

# 

编辑5

我意识到拔下插头后/dev/sdb/dev/sdc现在就可以了/dev/sdb。我确认smartctl -a /dev/sdb在拔掉坏磁盘的引导后序列号已更改。我很不幸,该驱动器不在保修范围内,所以我将为自己更换新的驱动器。


仅供参考:您应该看到[UU]以获得健康的镜子,而不是[U_]。如您所想,这意味着您的一面镜子不见了。@Halfgaar的建议是最好的。
蒂姆·S.

重新编辑6,您完成了mdadm --manage ... --add ...Halfgaar建议的内容吗?
MadHatter

2
关于Stack Exchange网站的关键问题之一是它们不是论坛,也没有线程。您问了一个问题,已经回答了。如果您还有其他(相关)问题,则应将其作为新问题提出,并在适用时引用原始问题。在执行此操作之前,您可能需要搜索站点。
user9517

Answers:


11

就像您在的输出中看不到损坏的驱动器(标记为F)一样,cat /proc/mdstat由于阵列降级,您已经启动了服务器。

您可以使用获取信息mdadm --detail /dev/md0。这可能会告诉您应该在哪个其他驱动器中。

要回复您的修改,请执行以下操作:

/dev/sdb先分析一下。使用smartctl -a检查(尤其是)重新分配的部门数和错误日志。用做自检smartctl -t long /dev/sdb。使用badblocks

然后:

  • 如果要更换/dev/sdb,请从复制分区表/dev/sdc。如果不是GPT,则可以使用sfdisk -d /dev/sdc | sfdisk /dev/sdb。或者,如果它们是GPT,则可以用于gdisk将分区表保存到文件,然后加载它。它隐藏在高级功能下。
  • 一般需要考虑的事情:如果您的(新)驱动器有4k扇区,请确保分区是4k对齐的
  • 如果要重新添加现有的/dev/sdb,则可能要mdadm --zero-superblock在所有现有分区上运行。
  • 然后你可以mdadm --manage /dev/md0 --add /dev/sdb6与同为md1sdb7

不用说,如果混合使用驱动器,某些命令将清除您的数据。所以,可以肯定的是sdcsdb...

编辑:关于坏块:如果任何软件级工具看到坏块,则驱动器被破坏。通常,磁盘通过在写入时透明地重新分配磁盘来隐藏它们。Google用于“硬盘驱动器重新分配”。您的smartctl -a输出应显示的重新分配扇区sdb。是的,您sdb已被踢出阵列,需要更换它。

编辑:关于smartctl -a输出。其中最重要的是两件事:

  • 它显示了60个重新分配的扇区。即使归一化的值仍然是99,并且只有在达到36时才正式为“坏”(倒计时),但是您不应该信任开始重新分配扇区的磁盘。因此,尤其是如果这个值开始改变,原始值,这很重要。您甚至可以配置smartd为您对其进行监视。
  • 错误日志显示了年龄为42372小时的条目。由于参数9(在您的情况下),您可以说这是最近的Power on hours。有一些无害的事项可能会导致SMART错误日志条目,例如发出错误的ATA命令,但是在这种情况下,由于阵列性能下降,很可能它们是相关的。

至于确定它在系统中的磁盘;例如,这样做dmesg |grep -i sdb会有所帮助。您的系统中可能有三个磁盘,并且sdb是第二个SATA控制器上的磁盘,可以将其命名为1或2,具体取决于它是从零开始还是从一个开始。

因为您可能从启动sda,所以您只需替换sdb并执行我上面概述的操作即可。如果启动驱动器损坏,则希望您具有:

  • 也将grub安装在其他磁盘上。
  • 有一台实际上可以从另一个磁盘引导的服务器。

前几天使用戴尔服务器时,它不想从sdb其中有空白的服务器开始sda。那需要一些说服力和即兴创作。

有时您需要将名称翻译ata1.01成真实的设备名称。例如,出现故障的磁盘将给出内核错误,提示“ ata1.01上的ATA异常”或类似的字样。请阅读此答案。(我将中央日志记录系统配置为向我警告那些内核错误,因为它们是挂起磁盘故障的可靠指示)。


现在还添加了EDIT2
stdcerr

1
@cerr我编辑答案,解释如何分析情况。
Halfgaar 2015年

1
@cerr我评论了您发现的坏块。
Halfgaar 2015年

1
我编辑了@cerr,以便对smartctl输出内容有一些了解。
Halfgaar 2015年

1
@cerr关于--add
Halfgaar,2015年
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.