web-dev-qa-db-ja.com

停電後にソフトウェアRAIDが機能しない

私のサーバーは昨日電源を失いました。電源が戻ったときに自動的に起動しましたが、RAIDが機能しなくなりました。

RAIDアレイは、mdadmで構築されたソフトウェアRAID6です。当初、アレイは8台のドライブを使用していました。数ヶ月前、ドライブが失敗することに気づきましたSMARTテストなので、交換しました。ドライブを交換する際に、元々以前のサーバーにあり、ZFSとしてフォーマットされたドライブを4つ追加しました( FreeNAS RAIDZの一部)、合計ドライブ数を12にします。

残念ながら、配列を展開するために使用した正確なコマンドを覚えておらず、そのコマンドはbash_historyに含まれていません。今日、mdadmが8つのディスクを報告し、fdiskがそれらの4つのドライブをZFSとして報告している理由はわかりません。過去数か月間、12ディスクのRAIDセットアップを実行していると確信しています。

私の知る限り、不良ドライブを交換して4台のドライブを追加してから、昨日までサーバーがシャットダウンまたは再起動していません。

停電以降に実行したmdadm関連のコマンドは、mdadm --detail /dev/md0mdadm --stop /dev/md0、およびmdadm --assemble --scan -vのみです。サーバーを再起動していません。

バックアップが必要であり、できるだけ早く実装することを認識しています。今のところ、データを回復する方法があることを願っています。

Debian9とmdadm3.4を実行しています。

その他の情報を提供させていただきます。 (私は自分自身をRAIDまたはmdadmの専門家とは決して見なしていないことに注意してください。)

更新:「良い」/「悪い」ドライブのmdadm検査の出力を追加しました。 「良好な」ドライブは、raid6および12ドライブを正しく報告しています。

mdadm --detail/dev/md0

(注:これは、mdadm --stop /dev/md0を実行する前の起動時でした。また、raid0を報告することにも注意してください。)

/dev/md0:
        Version : 1.2
     Raid Level : raid0
  Total Devices : 8
    Persistence : Superblock is persistent

          State : inactive

           Name : blackcanary:0  (local to Host blackcanary)
           UUID : 7bd22c29:465d927f:d0c1d08f:ba3694c9
         Events : 72036

    Number   Major   Minor   RaidDevice

       -       8       64        -        /dev/sde
       -       8       32        -        /dev/sdc
       -       8        0        -        /dev/sda
       -       8      112        -        /dev/sdh
       -       8       80        -        /dev/sdf
       -       8       48        -        /dev/sdd
       -       8      128        -        /dev/sdi
       -       8       96        -        /dev/sdg

fdisk -l

(注:/ dev/sdbと/ dev/sdjは、アレイに含めるべきではない2つのドライブのみです。)

Disk /dev/sdd: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/sde: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/sdc: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/sda: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/sdf: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/sdg: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/sdh: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/sdi: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/sdb: 57.9 GiB, 62109253632 bytes, 121307136 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 764C7B0B-574D-40DF-95C0-06D765AEB2D2

Device        Start       End  Sectors  Size Type
/dev/sdb1      2048   1050623  1048576  512M EFI System
/dev/sdb2   1050624  54255615 53204992 25.4G Linux filesystem
/dev/sdb3  54255616 121305087 67049472   32G Linux swap


Disk /dev/sdj: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sdk: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 41DFFB5A-7F8C-11E5-9D78-7824AF43D5FA

Device       Start        End    Sectors  Size Type
/dev/sdk1      128    4194431    4194304    2G FreeBSD swap
/dev/sdk2  4194432 7814037127 7809842696  3.7T FreeBSD ZFS


Disk /dev/sdl: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 40C2CEAE-7F8C-11E5-9D78-7824AF43D5FA

Device       Start        End    Sectors  Size Type
/dev/sdl1      128    4194431    4194304    2G FreeBSD swap
/dev/sdl2  4194432 7814037127 7809842696  3.7T FreeBSD ZFS


Disk /dev/sdm: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 402A1394-7F8C-11E5-9D78-7824AF43D5FA

Device       Start        End    Sectors  Size Type
/dev/sdm1      128    4194431    4194304    2G FreeBSD swap
/dev/sdm2  4194432 7814037127 7809842696  3.7T FreeBSD ZFS


Disk /dev/sdn: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 415081DC-7F8C-11E5-9D78-7824AF43D5FA

Device       Start        End    Sectors  Size Type
/dev/sdn1      128    4194431    4194304    2G FreeBSD swap
/dev/sdn2  4194432 7814037127 7809842696  3.7T FreeBSD ZFS

blkid

/dev/sdd: UUID="7bd22c29-465d-927f-d0c1-d08fba3694c9" UUID_SUB="91d8e433-aeb9-a4f2-75ca-10cf3ceb0a83" LABEL="blackcanary:0" TYPE="linux_raid_member"
/dev/sde: UUID="7bd22c29-465d-927f-d0c1-d08fba3694c9" UUID_SUB="6ccd4cee-9fdd-872c-add0-209a9d074eb5" LABEL="blackcanary:0" TYPE="linux_raid_member"
/dev/sdc: UUID="7bd22c29-465d-927f-d0c1-d08fba3694c9" UUID_SUB="11bf8212-7c04-0c8c-a061-168bda9c34a5" LABEL="blackcanary:0" TYPE="linux_raid_member"
/dev/sda: UUID="7bd22c29-465d-927f-d0c1-d08fba3694c9" UUID_SUB="6cee76b0-031c-bb6a-6c13-7d15d0b2feee" LABEL="blackcanary:0" TYPE="linux_raid_member"
/dev/sdf: UUID="7bd22c29-465d-927f-d0c1-d08fba3694c9" UUID_SUB="508cd116-e0ac-131c-cd0d-3c5c41c1cbba" LABEL="blackcanary:0" TYPE="linux_raid_member"
/dev/sdg: UUID="7bd22c29-465d-927f-d0c1-d08fba3694c9" UUID_SUB="0080d32e-7fea-037f-75a8-6e40dfa8fdfa" LABEL="blackcanary:0" TYPE="linux_raid_member"
/dev/sdh: UUID="7bd22c29-465d-927f-d0c1-d08fba3694c9" UUID_SUB="f1aa862e-6c4c-0239-5fb4-29d7a9dd7497" LABEL="blackcanary:0" TYPE="linux_raid_member"
/dev/sdi: UUID="7bd22c29-465d-927f-d0c1-d08fba3694c9" UUID_SUB="32472d1f-25c1-dfb3-fa9a-57ab3df17986" LABEL="blackcanary:0" TYPE="linux_raid_member"
/dev/sdb1: UUID="E15C-D029" TYPE="vfat" PARTUUID="dff9fca6-2eef-4084-845c-d780ca7b6cb8"
/dev/sdb2: UUID="bfd3d30c-de34-4e00-89b4-384bcbb7922d" TYPE="ext4" PARTUUID="7696f182-551e-447c-9549-155605cc48a3"
/dev/sdb3: UUID="7f65b504-ffe2-48e4-868f-a9db95865505" TYPE="swap" PARTUUID="48ecdc7c-fb0a-404e-bc02-178063515b6c"
/dev/sdj: UUID="b59275af-0825-4f25-96d2-aff0c3fef5e5" TYPE="ext4"
/dev/sdk1: PARTUUID="41f3ae62-7f8c-11e5-9d78-7824af43d5fa"
/dev/sdk2: LABEL="main" UUID="2939752790805872810" UUID_SUB="11544886583175140825" TYPE="zfs_member" PARTUUID="420ad019-7f8c-11e5-9d78-7824af43d5fa"
/dev/sdl1: PARTUUID="40d655e5-7f8c-11e5-9d78-7824af43d5fa"
/dev/sdl2: LABEL="main" UUID="2939752790805872810" UUID_SUB="15587016790013084755" TYPE="zfs_member" PARTUUID="40ef0474-7f8c-11e5-9d78-7824af43d5fa"
/dev/sdm1: PARTUUID="403ea9c7-7f8c-11e5-9d78-7824af43d5fa"
/dev/sdm2: LABEL="main" UUID="2939752790805872810" UUID_SUB="12390459856885165202" TYPE="zfs_member" PARTUUID="4057cbaa-7f8c-11e5-9d78-7824af43d5fa"
/dev/sdn1: PARTUUID="416507e6-7f8c-11e5-9d78-7824af43d5fa"
/dev/sdn2: LABEL="main" UUID="2939752790805872810" UUID_SUB="16896032374271545514" TYPE="zfs_member" PARTUUID="417ef281-7f8c-11e5-9d78-7824af43d5fa"

mdadm --asemble --scan -v

mdadm: looking for devices for /dev/md0
mdadm: No super block found on /dev/sdn2 (Expected magic a92b4efc, got b1f5ae15)
mdadm: no RAID superblock on /dev/sdn2
mdadm: No super block found on /dev/sdn1 (Expected magic a92b4efc, got 00000000)
mdadm: no RAID superblock on /dev/sdn1
mdadm: No super block found on /dev/sdn (Expected magic a92b4efc, got 00000000)
mdadm: no RAID superblock on /dev/sdn
mdadm: No super block found on /dev/sdm2 (Expected magic a92b4efc, got fd87a884)
mdadm: no RAID superblock on /dev/sdm2
mdadm: No super block found on /dev/sdm1 (Expected magic a92b4efc, got 00000000)
mdadm: no RAID superblock on /dev/sdm1
mdadm: No super block found on /dev/sdm (Expected magic a92b4efc, got 00000000)
mdadm: no RAID superblock on /dev/sdm
mdadm: No super block found on /dev/sdl2 (Expected magic a92b4efc, got 946313cc)
mdadm: no RAID superblock on /dev/sdl2
mdadm: No super block found on /dev/sdl1 (Expected magic a92b4efc, got 00000000)
mdadm: no RAID superblock on /dev/sdl1
mdadm: No super block found on /dev/sdl (Expected magic a92b4efc, got 00000000)
mdadm: no RAID superblock on /dev/sdl
mdadm: No super block found on /dev/sdk2 (Expected magic a92b4efc, got 4de36623)
mdadm: no RAID superblock on /dev/sdk2
mdadm: No super block found on /dev/sdk1 (Expected magic a92b4efc, got 00000000)
mdadm: no RAID superblock on /dev/sdk1
mdadm: No super block found on /dev/sdk (Expected magic a92b4efc, got 00000000)
mdadm: no RAID superblock on /dev/sdk
mdadm: No super block found on /dev/sdj (Expected magic a92b4efc, got 0000043c)
mdadm: no RAID superblock on /dev/sdj
mdadm: No super block found on /dev/sdb3 (Expected magic a92b4efc, got 00000000)
mdadm: no RAID superblock on /dev/sdb3
mdadm: No super block found on /dev/sdb2 (Expected magic a92b4efc, got 00000405)
mdadm: no RAID superblock on /dev/sdb2
mdadm: No super block found on /dev/sdb1 (Expected magic a92b4efc, got 00000000)
mdadm: no RAID superblock on /dev/sdb1
mdadm: No super block found on /dev/sdb (Expected magic a92b4efc, got 00000000)
mdadm: no RAID superblock on /dev/sdb
mdadm: /dev/sdi is identified as a member of /dev/md0, slot 7.
mdadm: /dev/sdh is identified as a member of /dev/md0, slot 6.
mdadm: /dev/sdg is identified as a member of /dev/md0, slot 5.
mdadm: /dev/sdf is identified as a member of /dev/md0, slot 4.
mdadm: /dev/sda is identified as a member of /dev/md0, slot 2.
mdadm: /dev/sdc is identified as a member of /dev/md0, slot 0.
mdadm: /dev/sde is identified as a member of /dev/md0, slot 3.
mdadm: /dev/sdd is identified as a member of /dev/md0, slot 1.
mdadm: added /dev/sdd to /dev/md0 as 1
mdadm: added /dev/sda to /dev/md0 as 2
mdadm: added /dev/sde to /dev/md0 as 3
mdadm: added /dev/sdf to /dev/md0 as 4
mdadm: added /dev/sdg to /dev/md0 as 5
mdadm: added /dev/sdh to /dev/md0 as 6
mdadm: added /dev/sdi to /dev/md0 as 7
mdadm: no uptodate device for slot 8 of /dev/md0
mdadm: no uptodate device for slot 9 of /dev/md0
mdadm: no uptodate device for slot 10 of /dev/md0
mdadm: no uptodate device for slot 11 of /dev/md0
mdadm: added /dev/sdc to /dev/md0 as 0
mdadm: /dev/md0 assembled from 8 drives - not enough to start the array.

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

# 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

# This configuration was auto-generated on Sun, 25 Jun 2017 22:28:24 -0500 by mkconf
ARRAY /dev/md0 metadata=1.2 name=blackcanary:0 UUID=7bd22c29:465d927f:d0c1d08f:ba3694c9

mdadm --examine/dev/sdd

(注:「良好な」8台のドライブのいずれについても非常に類似した情報が返されます)

/dev/sdd:
          Magic : a92b4efc
        Version : 1.2
    Feature Map : 0x1
     Array UUID : 7bd22c29:465d927f:d0c1d08f:ba3694c9
           Name : blackcanary:0  (local to Host blackcanary)
  Creation Time : Sun Jun 25 22:53:12 2017
     Raid Level : raid6
   Raid Devices : 12

 Avail Dev Size : 7813780144 (3725.90 GiB 4000.66 GB)
     Array Size : 39068897280 (37259.00 GiB 40006.55 GB)
  Used Dev Size : 7813779456 (3725.90 GiB 4000.66 GB)
    Data Offset : 257024 sectors
   Super Offset : 8 sectors
   Unused Space : before=256936 sectors, after=688 sectors
          State : clean
    Device UUID : 91d8e433:aeb9a4f2:75ca10cf:3ceb0a83

Internal Bitmap : 8 sectors from superblock
    Update Time : Sun Oct  7 14:23:36 2018
  Bad Block Log : 512 entries available at offset 72 sectors
       Checksum : b960e905 - correct
         Events : 72036

         Layout : left-symmetric
     Chunk Size : 512K

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

mdadm --examine/dev/sdk

(注:「不良」4ドライブのいずれについても同じ情報が返されます)

/dev/sdk:
   MBR Magic : aa55
Partition[0] :   4294967295 sectors at            1 (type ee)

fdisk -b 512 -t gpt -l/dev/sdn

Disk /dev/sdn: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 415081DC-7F8C-11E5-9D78-7824AF43D5FA

Device       Start        End    Sectors  Size Type
/dev/sdn1      128    4194431    4194304    2G FreeBSD swap
/dev/sdn2  4194432 7814037127 7809842696  3.7T FreeBSD ZFS

fdisk -b 4096 -t gpt -l/dev/sdn

Disk /dev/sdn: 3.7 TiB, 4000787030016 bytes, 976754646 sectors
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 415081DC-7F8C-11E5-9D78-7824AF43D5FA

Device       Start        End    Sectors  Size Type
/dev/sdn1      128    4194431    4194304   16G FreeBSD swap
/dev/sdn2  4194432 7814037127 7809842696 29.1T FreeBSD ZFS
1
Uze

多くの調査の結果、明らかなデータ損失なしにRAIDアレイを復元することができました。

最終的にはmdadm --create --assume-cleanを使用する必要がありました。 オーバーレイファイル を使用することを選択したので、正しい構成が見つかるまでさまざまな構成を非破壊的にテストできました。

「良い」ドライブでmdadm --examine /dev/sd*を使用して、順序を決定しました。次に、「不良」ドライブの可能な順列を生成し、マウント可能なファイルシステムができるまでそれらを実行しました。幸いなことに、私は24の可能な組み合わせしかありませんでした。

私は24の順列すべてを実行しましたが、マウントに成功しませんでした。マッパードライブの1つ(mdadm --examine /dev/mapper/sd*)を調べて、元のドライブと比較したところ、データオフセットが異なっていることがわかりました。 data-offsetパラメーターを構成に追加し、順列を再テストし、12回目の試行後に成功しました。

テスト中に実行したコマンドは次のとおりです。

mdadm --stop /dev/md0
mdadm --create --assume-clean --run --level=6 --data-offset=128512 --raid-devices=12 /dev/md0 /dev/mapper/sdb /dev/mapper/sdc /dev/mapper/sda /dev/mapper/sdd /dev/mapper/sde /dev/mapper/sdf /dev/mapper/sdg /dev/mapper/sdh /dev/mapper/sdn /dev/mapper/sdm /dev/mapper/sdl /dev/mapper/sdk
dumpe2fs /dev/md0
fsck.ext4 -v /dev/md0

ddを使用して「不良」ドライブのMBRとパーティションテーブルをバックアップし、「良好」ドライブと一致するようにMBRとパーティションテーブルをゼロで上書きしたので、これは問題にならないはずです。今後の再起動。

再構築に成功した後、新しいmdadm.confファイルを生成し、将来必要になった場合に備えて、アレイに関するできるだけ多くのデータを記録しました。今、私は真のバックアップソリューションを検討しています。

0
Uze