At first, there was a RAID0 array, to which I've added a new disk by issuing
mdadm --add
but when I've done that, the drive started to fail because of the power issues and the array has not started since then. Just after mdadm started to do its thing to move RAID0 to RAID4 type array.
I've tried to recreate the array but I've failed, because it now sees partitions that there were not created before. There was only one partition of the size of 2TB created on /dev/md/0 array using two 1TB drives.
sdb 8:16 0 931,5G 0 disk
└─md0 9:0 0 931,4G 0 raid4
├─md0p1 259:0 0 27,3G 0 md
└─md0p2 259:1 0 421G 0 md
sdc 8:32 0 931,5G 0 disk
└─md0 9:0 0 931,4G 0 raid4
├─md0p1 259:0 0 27,3G 0 md
└─md0p2 259:1 0 421G 0 md
Here's also --examine output (just after the array failed, but before I've tried to recreate the array)
muszy@nas:~$ sudo mdadm --examine /dev/sdb
/dev/sdb:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x44
Array UUID : 05b3504e:d335720b:a0d9c0ee:dd2e7a8f
Name : nas:0 (local to host nas)
Creation Time : Wed Oct 2 12:49:47 2019
Raid Level : raid4
Raid Devices : 4
Avail Dev Size : 1953260544 (931.39 GiB 1000.07 GB)
Array Size : 2929890816 (2794.16 GiB 3000.21 GB)
Data Offset : 264192 sectors
New Offset : 261120 sectors
Super Offset : 8 sectors
State : active
Device UUID : f8ce2e05:671f6377:767d7d05:4a0f7727
Reshape pos'n : 19646976 (18.74 GiB 20.12 GB)
Delta Devices : 1 (3->4)
Update Time : Fri Oct 11 12:28:20 2019
Bad Block Log : 512 entries available at offset 8 sectors
Checksum : 509e6f70 - correct
Events : 43
Chunk Size : 512K
Device Role : Active device 1
Array State : AA.. ('A' == active, '.' == missing, 'R' == replacing)
muszy@nas:~$ sudo mdadm --examine /dev/sdc
/dev/sdc:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x46
Array UUID : 05b3504e:d335720b:a0d9c0ee:dd2e7a8f
Name : nas:0 (local to host nas)
Creation Time : Wed Oct 2 12:49:47 2019
Raid Level : raid4
Raid Devices : 4
Avail Dev Size : 1953260976 (931.39 GiB 1000.07 GB)
Array Size : 2929890816 (2794.16 GiB 3000.21 GB)
Used Dev Size : 1953260544 (931.39 GiB 1000.07 GB)
Data Offset : 264192 sectors
New Offset : 261120 sectors
Super Offset : 8 sectors
Recovery Offset : 13097984 sectors
State : clean
Device UUID : 3fc0cbbf:068b4f7e:7359304e:b26ca865
Reshape pos'n : 19646976 (18.74 GiB 20.12 GB)
Delta Devices : 1 (3->4)
Update Time : Fri Oct 11 12:28:09 2019
Bad Block Log : 512 entries available at offset 264 sectors
Checksum : 99d7e462 - correct
Events : 41
Chunk Size : 512K
Device Role : Active device 2
Array State : AAA. ('A' == active, '.' == missing, 'R' == replacing)
muszy@nas:~$ sudo mdadm --examine /dev/sdd
/dev/sdd:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x44
Array UUID : 05b3504e:d335720b:a0d9c0ee:dd2e7a8f
Name : nas:0 (local to host nas)
Creation Time : Wed Oct 2 12:49:47 2019
Raid Level : raid4
Raid Devices : 4
Avail Dev Size : 1953260544 (931.39 GiB 1000.07 GB)
Array Size : 2929890816 (2794.16 GiB 3000.21 GB)
Data Offset : 264192 sectors
New Offset : 261120 sectors
Super Offset : 8 sectors
State : active
Device UUID : 9e985730:eddba18f:6f636c8a:79ecdfc2
Reshape pos'n : 19646976 (18.74 GiB 20.12 GB)
Delta Devices : 1 (3->4)
Update Time : Fri Oct 11 12:28:20 2019
Bad Block Log : 512 entries available at offset 8 sectors
Checksum : b45db8c4 - correct
Events : 43
Chunk Size : 512K
Device Role : Active device 0
Array State : AA.. ('A' == active, '.' == missing, 'R' == replacing)
Is there any chance I could recover the array with the information I've provided?
Thanks to frostschutz help, I've created the overlay and managed to start two arrays:
Array 1 (The old one "RAID0"):
parallel 'test -e /dev/loop{#} || mknod -m 660 /dev/looparray1{#} b 7 {#}' ::: /dev/sda /dev/sdb
parallel truncate -s1000G array1-overlay-{/} ::: /dev/sda /dev/sdb
parallel 'size=$(blockdev --getsize {}); loop=$(losetup -f --show -- array1-overlay-{/}); echo 0 $size snapshot {} $loop P 8 | dmsetup create array1{/}' ::: /dev/sda /dev/sdb
mdadm --create /dev/md/array1 --assume-clean --level=0 --chunk=512K --data-offset=264192s --raid-devices=2 /dev/mapper/array1sda /dev/mapper/array1sdb
Linux sees a "2TB unknown" partition
Array 2 (The new one "RAID4"):
parallel 'test -e /dev/loop{#} || mknod -m 660 /dev/looparray2{#} b 7 {#}' ::: /dev/sda /dev/sdb /dev/sdd
parallel truncate -s1000G array2-overlay-{/} ::: /dev/sda /dev/sdb /dev/sdd
parallel 'size=$(blockdev --getsize {}); loop=$(losetup -f --show -- array2-overlay-{/}); echo 0 $size snapshot {} $loop P 8 | dmsetup create array2{/}' ::: /dev/sda /dev/sdb /dev/sdd
mdadm --create /dev/md/array2 --assume-clean --level=0 --chunk=512K --data-offset=261120s --raid-devices=3 /dev/mapper/array2sda /dev/mapper/array2sdb /dev/mapper/array2sdd
Linux sees an EXT4 partition with size of 3TB, but now it's not mountable, TestDisk sees the directory structure (marked as red).
When I'm trying to join them together:
blockdev --getsize /dev/md/array1
3906521088
blockdev --getsize /dev/md/array2
5859790848
echo -e '0 3906521088 linear /dev/md/array1 0'\\n'3906521088 1953269760 linear /dev/md/array2 3906521088' | dmsetup create rec-array
it creates a 3TB drive with nothing useful.