I have two identical 3 TB disks that were in a RAID1 array, where one disk crashed. I replaced the failed disk, but not after the RAID partitions got messed up.
I need to figure out how to restore the RAID array and get at my ext4 partition.
State of the surviving disk
Here are the properties of the surviving disk:
# fdisk -l /dev/sda
fdisk: device has more than 2^32 sectors, can't use all of them
Disk /dev/sda: 2199.0 GB, 2199023255040 bytes
255 heads, 63 sectors/track, 267349 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 1 267350 2147483647+ ee EFI GPT
# parted /dev/sda print
Model: ATA ST3000DM001-9YN1 (scsi)
Disk /dev/sda: 3001GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 131kB 2550MB 2550MB ext4 raid
2 2550MB 4698MB 2147MB linux-swap(v1) raid
5 4840MB 3001GB 2996GB raid
I replaced the failed drive, and cloned the surviving drive to it so I have something to work with. I cloned the drives with dd if=/dev/sdb of=/dev/sda conv=noerror bs=64M, and now /dev/sda and /dev/sdb are identical.
Here is the RAID information:
# cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4]
md1 : active raid1 sdb2[1]
2097088 blocks [2/1] [_U]
md0 : active raid1 sdb1[1]
2490176 blocks [2/1] [_U]
unused devices: <none>
It seems that md2 is missing.
What TestDisk tells me
Here is what testdisk 6.14-WIP finds on the surviving disk:
Disk /dev/sda - 3000 GB / 2794 GiB - CHS 364801 255 63
Current partition structure:
Partition Start End Size in sectors
1 P Linux Raid 256 4980735 4980480 [md0]
2 P Linux Raid 4980736 9175039 4194304 [md1]
Invalid RAID superblock
5 P Linux Raid 9453280 5860519007 5851065728
5 P Linux Raid 9453280 5860519007 5851065728
# After a quick search
Disk /dev/sda - 3000 GB / 2794 GiB - CHS 364801 255 63
Partition Start End Size in sectors
D MS Data 256 4980607 4980352 [1.41.12-2197]
D Linux Raid 256 4980735 4980480 [md0]
D Linux Swap 4980736 9174895 4194160
D Linux Raid 4980736 9175039 4194304 [md1]
>P MS Data 9481056 5858437983 5848956928 [1.41.12-2228]
And listing the files on the last partition in the list shows all of my files intact.
Here is what testdisk 6.14-WIP finds on the failed disk:
Disk /dev/sda - 3000 GB / 2794 GiB - CHS 364801 255 63
Current partition structure:
Partition Start End Size in sectors
1 P Linux Raid 256 4980735 4980480 [md0]
2 P Linux Raid 4980736 9175039 4194304 [md1]
5 P Linux Raid 9453280 5860519007 5851065728 [DiskStation:2]
# After a quicksearch
Disk /dev/sda - 3000 GB / 2794 GiB - CHS 364801 255 63
Partition Start End Size in sectors
>D MS Data 256 4980607 4980352 [1.41.12-2197]
D Linux Raid 256 4980735 4980480 [md0]
D Linux Swap 4980736 9174895 4194160
D Linux Raid 4980736 9175039 4194304 [md1]
P Linux Raid 9453280 5860516583 5851063304 [DiskStation:2]
Here is what testdisk 6.14-WIP finds on the raid devices:
Disk /dev/md0 - 2549 MB / 2431 MiB - CHS 622544 2 4
Current partition structure:
Partition Start End Size in sectors
P ext4 0 0 1 622543 1 4 4980352 [1.41.12-2197]
Disk /dev/md1 - 2147 MB / 2047 MiB - CHS 524272 2 4
Current partition structure:
Partition Start End Size in sectors
P Linux SWAP 2 0 0 1 524271 1 4 4194176
Recreating the RAID1 array
Update: I re-created the RAID1 array with just one disk, but the partitions won't mount.
# mdadm --create /dev/md2 --metadata=1.2 --verbose --level=mirror --raid-devices=2 missing /dev/sdb5
mdadm: size set to 2925531648K
mdadm: array /dev/md2 started.
# cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4]
md2 : active raid1 sdb5[1]
2925531648 blocks super 1.2 [2/1] [_U]
md1 : active raid1 sdb2[1]
2097088 blocks [2/1] [_U]
md0 : active raid1 sdb1[1]
2490176 blocks [2/1] [_U]
unused devices: <none>
# parted /dev/md2 print
Error: /dev/md2: unrecognised disk label
Model: Linux Software RAID Array (md)
Disk /dev/md2: 2996GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:
# parted /dev/sdb5 print
Error: /dev/sdb5: unrecognised disk label
Model: Unknown (unknown)
Disk /dev/sdb5: 2996GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:
# mdadm --detail /dev/md2
/dev/md2:
Version : 1.2
Creation Time : Wed Dec 5 22:58:38 2012
Raid Level : raid1
Array Size : 2925531648 (2790.00 GiB 2995.74 GB)
Used Dev Size : 2925531648 (2790.00 GiB 2995.74 GB)
Raid Devices : 2
Total Devices : 1
Persistence : Superblock is persistent
Update Time : Thu Dec 6 00:10:43 2012
State : clean, degraded
Active Devices : 1
Working Devices : 1
Failed Devices : 0
Spare Devices : 0
Name : DiskStation:2 (local to host DiskStation)
UUID : ccd2b669:fbd73c43:3c84590d:74bff584
Events : 6
Number Major Minor RaidDevice State
0 0 0 0 removed
1 8 21 1 active sync /dev/sdb5
# mdadm --examine /dev/sdb5
/dev/sdb5:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x0
Array UUID : ccd2b669:fbd73c43:3c84590d:74bff584
Name : DiskStation:2 (local to host DiskStation)
Creation Time : Wed Dec 5 22:58:38 2012
Raid Level : raid1
Raid Devices : 2
Avail Dev Size : 5851063680 (2790.00 GiB 2995.74 GB)
Array Size : 5851063296 (2790.00 GiB 2995.74 GB)
Used Dev Size : 5851063296 (2790.00 GiB 2995.74 GB)
Data Offset : 2048 sectors
Super Offset : 8 sectors
State : clean
Device UUID : 234e84ca:1b65842b:6cd51fb9:521727ae
Update Time : Thu Dec 6 00:46:24 2012
Checksum : bb03c6da - correct
Events : 8
Device Role : Active device 1
Array State : .A ('A' == active, '.' == missing)
Failing to mount the array
# mount /dev/md2 /mnt/md2
mount: mounting /dev/md2 on /mnt/md2 failed: No such device
# mount /dev/sdb5 /mnt/sdb5
mount: mounting /dev/sdb5 on /mnt/sdb5 failed: No such device