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하고 입력한 다음 g다음 을 수행했습니다 w.

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 파일 시스템을 확인하고 복구하곤 했습니다. 오류를 자동으로 수정한 후 어레이를 마운트할 수 있었고 거기에서 모든 데이터가 손상되지 않은 것을 발견했습니다!

빠른 알림데이터를 지루하게 만들기 전에 작업 내용을 다시 확인하세요! :디

관련 정보