2

I installed a new disk today and was prepping it, before realizing that I'd done my "prep" work on an existing RAID1 array!! I'd LOVE to be able to recovered if possible.

My array was created as /dev/md2 from drives /dev/sdf and /dev/sdh. Here's what I saw with fdisk -l before breaking anything:

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

I then ran fdisk /dev/md2 and then typed g and then 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 now showed:

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

I then ran fdisk /dev/md2 again and then ran n with all defaults:

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.

I then ran fdisk -l again before realizing my stupid mistake:

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

Here is the current state of /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

I've unmounted /dev/md2 for now and have commented out the line for the array in /etc/mdadm/mdadm.conf.

Curiously, before unmounting, I saw this when checking for disk usage:

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

Though I'm not sure how to interpret this, since these are 12TB disks in a RAID1 array.

I originally created the array using this DigitalOcean tutorial, which culminated in creating a filesystem with:

mkfs.ext4 -F /dev/md2

I'm not sure where to go from here and am nervous about doing something (else) dumb and destroying the data.

Is there any hope for recovering this array?

THANK YOU ALL for your help and time! :)

0

1 Answer 1

2

I was able to recover the ext4 filesystem using the instructions found here:

I used fsck.ext4 -vy /dev/md2 to check and repair the ext4 filesystem. After some automated correction of errors, I was and then able to mount the array, where I found all of my data intact!

Quick reminder to double check your work before borking you data! :D

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .