손상된 소프트웨어 RAID5 어레이(mdadm)를 복구하는 방법은 무엇입니까?

손상된 소프트웨어 RAID5 어레이(mdadm)를 복구하는 방법은 무엇입니까?

kvm 및 qemu를 설치하고 재부팅하기 전에 작동하는 RAID5 어레이가 있었습니다. 그러면 /dev/md0을 마운트할 수 없기 때문에 시스템이 부팅되지 않습니다.

cat /proc/mdstat를 실행하면 다음이 제공됩니다.

Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] 
md0 : inactive sdb[2](S) sda[0](S)
      1953263024 blocks super 1.2
       
unused devices: <none>

어레이에 sda, sdb 및 sdc가 있지만 sda 및 sdb만 있는 것처럼 보이지만 지금은 백업입니다.

각 디스크를 확인하면 다음이 제공됩니다.

sudo mdadm --examine /dev/sda
/dev/sda:
          Magic : a92b4efc
        Version : 1.2
    Feature Map : 0x1
     Array UUID : e25ff5c6:90186486:4f001b87:27056b4a
           Name : SAN1:0  (local to host SAN1)
  Creation Time : Sat Jul 16 17:13:01 2022
     Raid Level : raid5
   Raid Devices : 3

 Avail Dev Size : 1953263024 (931.39 GiB 1000.07 GB)
     Array Size : 1953260544 (1862.77 GiB 2000.14 GB)
  Used Dev Size : 1953260544 (931.39 GiB 1000.07 GB)
    Data Offset : 262144 sectors
   Super Offset : 8 sectors
   Unused Space : before=262064 sectors, after=2480 sectors
          State : clean
    Device UUID : 16904f75:c2ddd8b0:75025adb:0a09effa

Internal Bitmap : 8 sectors from superblock
    Update Time : Wed Jul 20 18:59:56 2022
  Bad Block Log : 512 entries available at offset 16 sectors
       Checksum : 8d2ba8a7 - correct
         Events : 4167

         Layout : left-symmetric
     Chunk Size : 512K

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

sudo mdadm --examine /dev/sdb
/dev/sdb:
          Magic : a92b4efc
        Version : 1.2
    Feature Map : 0x1
     Array UUID : e25ff5c6:90186486:4f001b87:27056b4a
           Name : SAN1:0  (local to host SAN1)
  Creation Time : Sat Jul 16 17:13:01 2022
     Raid Level : raid5
   Raid Devices : 3

 Avail Dev Size : 1953263024 (931.39 GiB 1000.07 GB)
     Array Size : 1953260544 (1862.77 GiB 2000.14 GB)
  Used Dev Size : 1953260544 (931.39 GiB 1000.07 GB)
    Data Offset : 262144 sectors
   Super Offset : 8 sectors
   Unused Space : before=262064 sectors, after=2480 sectors
          State : clean
    Device UUID : 02a449d0:be934563:ff4293f3:42e4ed52

Internal Bitmap : 8 sectors from superblock
    Update Time : Wed Jul 20 18:59:56 2022
  Bad Block Log : 512 entries available at offset 16 sectors
       Checksum : aca8e53 - correct
         Events : 4167

         Layout : left-symmetric
     Chunk Size : 512K

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

sudo mdadm --examine /dev/sdc
/dev/sdc:
   MBR Magic : aa55
Partition[0] :   1953525167 sectors at            1 (type ee)

그리고 sudo mdadm --examine --scan

ARRAY /dev/md/0  metadata=1.2 UUID=e25ff5c6:90186486:4f001b87:27056b4a name=SAN1:0

내 mdadm.conf는 다음과 같습니다.

 mdadm.conf
#
# !NB! Run update-initramfs -u after updating this file.
# !NB! This will ensure that initramfs has an uptodate copy.
#
# 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

# 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
#level=raid5 
#num-devices=3

# This configuration was auto-generated on Fri, 15 Jul 2022 20:17:00 +0100 by mkconf
ARRAY /dev/md0 uuid=e25ff5c6:90186486:4f001b87:27056b4a

어레이를 수정하는 방법에 대한 아이디어가 있습니까? 이상적으로는 가능하다면 백업으로 돌아가지 않고도 이 작업을 수행할 수 있기를 바랍니다.

나는 시도했다:

sudo mdadm --stop /dev/md0
sudo mdadm --assemble /dev/md0 /dev/sda /dev/sdb /dev/sdc --verbose

알겠어요:

mdadm: looking for devices for /dev/md0
mdadm: No super block found on /dev/sdc (Expected magic a92b4efc, got 00000000)
mdadm: no RAID superblock on /dev/sdc
mdadm: /dev/sdc has no superblock - assembly aborted

업데이트 1: 좋습니다. 실행했는데 mdadm -D /dev/md1다시 다운그레이드되었습니다. 나쁘지 않은데.. 세 번째 디스크만 다시 추가하면 되는데..

업데이트 2: 성공적으로 재구축한 후 재부팅하고 동일한 문제가 발생하여 다시 수정하려고 시도했습니다.

lex@SAN1:/etc/apt$ sudo mdadm --assemble /dev/md0
alex@SAN1:/etc/apt$ sudo mdadm -D /dev/md0
/dev/md0:
           Version : 1.2
        Raid Level : raid0
     Total Devices : 2
       Persistence : Superblock is persistent

             State : inactive
   Working Devices : 2

              Name : SAN1:0  (local to host SAN1)
              UUID : e25ff5c6:90186486:4f001b87:27056b4a
            Events : 6058

    Number   Major   Minor   RaidDevice

       -       8        0        -        /dev/sda
       -       8       16        -        /dev/sdb
alex@SAN1:/etc/apt$ cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] 
md0 : inactive sdb[2](S) sda[0](S)
      1953263024 blocks super 1.2
       
unused devices: <none>
alex@SAN1:/etc/apt$ sudo mdadm --stop /dev/md0
mdadm: stopped /dev/md0
alex@SAN1:/etc/apt$ cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] 
unused devices: <none>
alex@SAN1:/etc/apt$ sudo mdadm -D /dev/md0
mdadm: cannot open /dev/md0: No such file or directory
alex@SAN1:/etc/apt$ sudo mdadm --assemble /dev/md0
mdadm: /dev/md0 has been started with 2 drives (out of 3).
alex@SAN1:/etc/apt$ cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] 
md0 : active (auto-read-only) raid5 sda[0] sdb[2]
      1953260544 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/2] [UU_]
      bitmap: 0/8 pages [0KB], 65536KB chunk

unused devices: <none>

업데이트 2a:

나는 다음을 시도했다:

sudo gdisk /dev/sdc
GPT fdisk (gdisk) version 1.0.6

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): x

Expert command (? for help): z
About to wipe out GPT on /dev/sdc. Proceed? (Y/N): y
GPT data structures destroyed! You may now partition the disk using fdisk or
other utilities.
Blank out MBR? (Y/N): y

다시 어레이에 추가하고, 재구축하고 다시 재부팅한 후 2시간 후에 어떤 일이 일어나는지 살펴보겠습니다. :(

디스크 3에 무슨 문제가 있는지 아시나요?

감사해요

답변1

좋아, 문제를 찾은 것 같아.

다음 명령을 실행한 후:

sudo mdadm --detail --scan | sudo tee -a /etc/mdadm/mdadm.conf

나는 현재 다음을 가지고 있습니다:

ARRAY /dev/md0 metadata=1.2 name=SAN1:0 UUID=e25ff5c6:90186486:4f001b87:27056b4a

바꾸다:

ARRAY /dev/md0 uuid=e25ff5c6:90186486:4f001b87:27056b4a

다시 시작한 후에는 모든 것이 괜찮아 보입니다.

cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid1] [raid10] 
md0 : active raid5 sda[0] sdb[2] sdc[3]
      1953260544 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/3] [UUU]
      bitmap: 0/8 pages [0KB], 65536KB chunk

unused devices: <none>

이것이 같은 상황에 있는 다른 사람들에게도 도움이 되기를 바랍니다.

관련 정보