从外部磁盘柜故障中安全恢复 Linux(CentOS 7)中的磁盘标签和 raid0

从外部磁盘柜故障中安全恢复 Linux(CentOS 7)中的磁盘标签和 raid0

我的外置磁盘柜与服务器之间的 SAS 电缆坏了,于是我换了一条新的。但是重新连接后,所有磁盘的标签都变了,例如 sdi --> sdu、sdj --> sdv 等。而且由这些磁盘组成的 RAID0 阵列也失效了。

更多详细信息:raid0 阵列是从 sd[ijklmnopqrst] 创建的。重新连接后,所有 12 个磁盘标签都已更改。我从 fdisk 收到的错误消息是fdisk: cannot open /dev/md126: Input/output error

输出cat /proc/mdstat

Personalities : [raid0] [raid6] [raid5] [raid4] 
md125 : active raid5 sdd[2] sdc[1] sdb[0]
      11718486016 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/3] [UUU]
      bitmap: 2/44 pages [8KB], 65536KB chunk

md126 : active raid0 sdj[0] sdi[9] sds[4] sdq[11] sdo[3] sdp[7] sdt[8] sdm[10] sdk[5] sdl[6] sdr[2] sdn[1]
      46882646016 blocks super 1.2 512k chunks

md127 : active raid0 sdh[3] sdg[2] sdf[1] sde[0]
      23436972032 blocks super 1.2 512k chunks

unused devices: <none>

输出lsblk

NAME               MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINT
sda                  8:0    0  5.5T  0 disk  
├─sda1               8:1    0  200M  0 part  /boot/efi
├─sda2               8:2    0  500M  0 part  /boot
└─sda3               8:3    0  416G  0 part  
  ├─centos-root    253:0    0  100G  0 lvm   /
  ├─centos-swap    253:1    0   16G  0 lvm   [SWAP]
  ├─centos-var     253:2    0   50G  0 lvm   /var
  └─centos-install 253:3    0  250G  0 lvm   
sdb                  8:16   0  5.5T  0 disk  
└─md125              9:125  0 10.9T  0 raid5 /home
sdc                  8:32   0  5.5T  0 disk  
└─md125              9:125  0 10.9T  0 raid5 /home
sdd                  8:48   0  5.5T  0 disk  
└─md125              9:125  0 10.9T  0 raid5 /home
sde                  8:64   0  5.5T  0 disk  
└─md127              9:127  0 21.8T  0 raid0 /temp
sdf                  8:80   0  5.5T  0 disk  
└─md127              9:127  0 21.8T  0 raid0 /temp
sdg                  8:96   0  5.5T  0 disk  
└─md127              9:127  0 21.8T  0 raid0 /temp
sdh                  8:112  0  5.5T  0 disk  
└─md127              9:127  0 21.8T  0 raid0 /temp
sdu                 65:64   0  3.7T  0 disk  
sdv                 65:80   0  3.7T  0 disk  
sdw                 65:96   0  3.7T  0 disk  
sdx                 65:112  0  3.7T  0 disk  
sdy                 65:128  0  3.7T  0 disk  
sdz                 65:144  0  3.7T  0 disk  
sdaa                65:160  0  3.7T  0 disk  
sdab                65:176  0  3.7T  0 disk  
sdac                65:192  0  3.7T  0 disk  
sdad                65:208  0  3.7T  0 disk  
sdae                65:224  0  3.7T  0 disk  
sdaf                65:240  0  3.7T  0 disk

/etc/mdadm.conf(CentOS重启后将md1改为md126):

ARRAY /dev/md0 UUID=a540f7c4-5839-4154-8399-42036a8664cf
ARRAY /dev/md1 UUID=759f63aa-b049-4e86-b4ce-c2391438807f
ARRAY /dev/md2 UUID=4ab4e822-9e63-41d0-a07b-daae3ea2bff7

ARRAY /dev/md0 UUID=a540f7c4-5839-4154-8399-42036a8664cf
ARRAY /dev/md1 UUID=759f63aa-b049-4e86-b4ce-c2391438807f
ARRAY /dev/md2 UUID=4ab4e822-9e63-41d0-a07b-daae3ea2bff7

mdadm -D /dev/md126以及(失败的 raid0)的输出:

/dev/md126:
        Version : 1.2
  Creation Time : Tue Apr  5 19:54:19 2016
     Raid Level : raid0
     Array Size : 46882646016 (44710.78 GiB 48007.83 GB)
   Raid Devices : 12
  Total Devices : 12
    Persistence : Superblock is persistent

    Update Time : Tue Apr  5 19:54:19 2016
          State : clean 
 Active Devices : 12
Working Devices : 12
 Failed Devices : 0
  Spare Devices : 0

     Chunk Size : 512K

    Number   Major   Minor   RaidDevice State
       0       8      144        0      active sync
       1       8      208        1      active sync
       2      65       16        2      active sync
       3       8      224        3      active sync
       4      65       32        4      active sync
       5       8      160        5      active sync
       6       8      176        6      active sync
       7       8      240        7      active sync
       8      65       48        8      active sync
       9       8      128        9      active sync
      10       8      192       10      active sync
      11      65        0       11      active sync

看来 12 盘 raid0 阵列仍然存在。以下是mdadm --examine /dev/sdu(以前在 md126 中)的输出:

/dev/sdu:
          Magic : a92b4efc
        Version : 1.2
    Feature Map : 0x0
     Array UUID : fef2dd89:7ef6045d:0b671362:244393f4
           Name : storage1.cluster.net:2
  Creation Time : Tue Apr  5 19:54:19 2016
     Raid Level : raid0
   Raid Devices : 12

 Avail Dev Size : 7813775024 (3725.90 GiB 4000.65 GB)
    Data Offset : 262144 sectors
   Super Offset : 8 sectors
   Unused Space : before=262056 sectors, after=0 sectors
          State : clean
    Device UUID : 82e28b37:5308ad64:ab0209d6:21b23484

    Update Time : Tue Apr  5 19:54:19 2016
  Bad Block Log : 512 entries available at offset 72 sectors
       Checksum : 5d2d5658 - correct
         Events : 0

     Chunk Size : 512K

   Device Role : Active device 9
   Array State : AAAAAAAAAAAA ('A' == active, '.' == missing, 'R' == replacing)

错误消息来自dmesg | tail

[3525097.349398] XFS (md126): xfs_log_force: error -5 returned.
[3525127.415308] XFS (md126): xfs_log_force: error -5 returned.
[3525157.481331] XFS (md126): xfs_log_force: error -5 returned.
[3525187.547243] XFS (md126): xfs_log_force: error -5 returned.
[3525217.613119] XFS (md126): xfs_log_force: error -5 returned.
[3525247.679038] XFS (md126): xfs_log_force: error -5 returned.
[3525277.744885] XFS (md126): xfs_log_force: error -5 returned.
[3525307.810813] XFS (md126): xfs_log_force: error -5 returned.
[3525337.876736] XFS (md126): xfs_log_force: error -5 returned.
[3525367.942628] XFS (md126): xfs_log_force: error -5 returned.

有没有什么方法可以恢复这些磁盘标签以及 RAID0 阵列而不丢失数据?

答案1

我只需重新启动系统即可解决问题。

相关内容