Fdisk usado accidentalmente en la matriz mdadm RAID1, ¿puedo recuperar mis datos?

Fdisk usado accidentalmente en la matriz mdadm RAID1, ¿puedo recuperar mis datos?

Instalé un disco nuevo hoy y lo estaba preparando, antes de darme cuenta de que había hecho mi trabajo de "preparación" en una matriz RAID1 existente. Me encantaría poder recuperarme si es posible.

Mi matriz fue creada como/dev/md2de unidades/dev/sdfy/dev/sdh. Esto es lo que vi confdisk -l antesromper cualquier cosa:

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

Luego corrí fdisk /dev/md2y luego escribí gy luego 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 -lahora mostró:

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

Luego ejecuté fdisk /dev/md2nuevamente y luego ejecuté ncon todos los valores predeterminados:

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.

Luego corrí fdisk -lde nuevo antes de darme cuenta de mi estúpido error:

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

Aquí está el estado actual de /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

He desmontado /dev/md2 por ahora y he comentado la línea de la matriz en /etc/mdadm/mdadm.conf.

Curiosamente, antes de desmontar, vi esto al comprobar el uso del disco:

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

Aunque no estoy seguro de cómo interpretar esto, ya que se trata de discos de 12 TB en una matriz RAID1.

Originalmente creé la matriz usandoeste tutorial de DigitalOcean, que culminó con la creación de un sistema de archivos con:

mkfs.ext4 -F /dev/md2

No estoy seguro de a dónde ir desde aquí y estoy nervioso por hacer algo (más) tonto y destruir los datos.

¿Hay alguna esperanza de recuperar esta matriz?

¡GRACIAS A TODOS por vuestra ayuda y tiempo! :)

Respuesta1

Pude recuperar el sistema de archivos ext4 usando las instrucciones encontradasaquí:

Solía fsck.ext4 -vy /dev/md2​​​​comprobar y reparar el sistema de archivos ext4. Después de una corrección automatizada de errores, pude montar la matriz, ¡donde encontré todos mis datos intactos!

recordatorio rápido paraComprueba tu trabajo antes de modificar tus datos.! :D

información relacionada