mdadm RAID1 アレイで誤って fdisk を使用しましたが、データを回復できますか?

mdadm RAID1 アレイで誤って fdisk を使用しましたが、データを回復できますか?

今日、新しいディスクをインストールして準備をしていたのですが、既存の RAID1 アレイで「準備」作業を行っていたことに気付きました!! 可能であれば、回復できればいいのですが。

私の配列は次のように作成されました/dev/md2ドライブから/dev/sdfそして/dev/sdh. 私が見たものは次のとおりですfdisk -l 前に何かを壊す:

Disk /dev/sdf: 10.91 TiB, 12000138625024 bytes, 23437770752 sectors
Disk model: Generic DISK01  
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: dos
Disk identifier: 0x00000000

Device     Boot Start        End    Sectors Size Id Type
/dev/sdf1           1 4294967295 4294967295   2T ee GPT

Partition 1 does not start on physical sector boundary.

...

Disk /dev/sdh: 10.91 TiB, 12000138625024 bytes, 23437770752 sectors
Disk model: Generic DISK03  
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: dos
Disk identifier: 0x00000000

Device     Boot Start        End    Sectors Size Id Type
/dev/sdh1           1 4294967295 4294967295   2T ee GPT

Partition 1 does not start on physical sector boundary.

...

Disk /dev/md2: 10.91 TiB, 12000003358720 bytes, 23437506560 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

次に実行し、次のようにfdisk /dev/md2入力しました:gw

Command (m for help): g
Created a new GPT disklabel (GUID: C3FA8F3E-4DD4-AD47-B2D4-F838EF831A2E).
The device contains 'ext4' signature and it will be removed by a write command. See fdisk(8) man page and --wipe option for more details.

Command (m for help): w

The partition table has been altered.
Syncing disks.

fdisk -l現在表示されています:

Disk /dev/sdf: 10.91 TiB, 12000138625024 bytes, 23437770752 sectors
Disk model: Generic DISK01  
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: dos
Disk identifier: 0x00000000

Device     Boot Start        End    Sectors Size Id Type
/dev/sdf1           1 4294967295 4294967295   2T ee GPT

Partition 1 does not start on physical sector boundary.

...

Disk /dev/sdh: 10.91 TiB, 12000138625024 bytes, 23437770752 sectors
Disk model: Generic DISK03  
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: dos
Disk identifier: 0x00000000

Device     Boot Start        End    Sectors Size Id Type
/dev/sdh1           1 4294967295 4294967295   2T ee GPT

Partition 1 does not start on physical sector boundary.

...

Disk /dev/md2: 10.91 TiB, 12000003358720 bytes, 23437506560 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: C3FA8F3E-4DD4-AD47-B2D4-F838EF831A2E

その後、fdisk /dev/md2再度実行し、nすべてデフォルトで実行しました。

Command (m for help): n
Partition number (1-128, default 1): 
First sector (2048-23437506526, default 2048): 
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-23437506526, default 23437506526): 

Created a new partition 1 of type 'Linux filesystem' and of size 10.9 TiB.

Command (m for help): w
The partition table has been altered.
Syncing disks.

その後、私はfdisk -l自分の愚かなミスに気づく前に、再び走りました。

Disk /dev/sdf: 10.91 TiB, 12000138625024 bytes, 23437770752 sectors
Disk model: Generic DISK01  
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: dos
Disk identifier: 0x00000000

Device     Boot Start        End    Sectors Size Id Type
/dev/sdf1           1 4294967295 4294967295   2T ee GPT

Partition 1 does not start on physical sector boundary.

...

Disk /dev/sdh: 10.91 TiB, 12000138625024 bytes, 23437770752 sectors
Disk model: Generic DISK03  
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: dos
Disk identifier: 0x00000000

Device     Boot Start        End    Sectors Size Id Type
/dev/sdh1           1 4294967295 4294967295   2T ee GPT

Partition 1 does not start on physical sector boundary.

...


Disk /dev/md2: 10.91 TiB, 12000003358720 bytes, 23437506560 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: C3FA8F3E-4DD4-AD47-B2D4-F838EF831A2E

Device     Start         End     Sectors  Size Type
/dev/md2p1  2048 23437506526 23437504479 10.9T Linux filesystem

現在の状態は次のとおりです/proc/mdstat:

md2 : active raid1 sdh[1] sdf[0]
      11718753280 blocks super 1.2 [2/2] [UU]
      bitmap: 0/88 pages [0KB], 65536KB chunk

md1 : active raid1 sda[0] sdb[1]
      15625747456 blocks super 1.2 [2/2] [UU]
      bitmap: 0/117 pages [0KB], 65536KB chunk

md0 : active raid1 sdc[0] sdd[1]
      15625747456 blocks super 1.2 [2/2] [UU]
      bitmap: 0/117 pages [0KB], 65536KB chunk

とりあえず /dev/md2 をアンマウントし、 のアレイの行をコメント アウトしました/etc/mdadm/mdadm.conf

興味深いことに、アンマウントする前にディスクの使用状況を確認したときに次のメッセージが表示されました。

plexadmin@petaccio-plex:/mnt$ df -h
Filesystem      Size  Used Avail Use% Mounted on
...
/dev/md2        4.4T  3.8T     0 100% /mnt/md2
...

ただし、これらは RAID1 アレイ内の 12TB ディスクなので、これをどのように解釈すればよいかわかりません。

私はもともと配列を次のように作成しましたこのDigitalOceanチュートリアルその結果、次のようなファイルシステムが作成されました。

mkfs.ext4 -F /dev/md2

ここからどうしたらいいのかわからず、何か愚かなことをしてデータを破壊してしまうのではないかと不安です。

このアレイを回復できる見込みはありますか?

皆様のご協力とお時間に感謝いたします! :)

答え1

見つかった手順を使用してext4ファイルシステムを回復することができましたここ:

私はfsck.ext4 -vy /dev/md2ext4 ファイルシステムをチェックして修復していました。いくつかのエラーを自動的に修正した後、アレイをマウントすることができ、すべてのデータがそのまま残っていることが確認できました。

簡単なリマインダーデータを壊す前に作業を再度確認してください! :D

関連情報