How can I fix my corrupted RAID1 ext4 partition on a Synology DS212 NAS?

Posted by Neil on Server Fault See other posts from Server Fault or by Neil
Published on 2012-12-05T03:44:56Z Indexed on 2012/12/05 5:09 UTC
Read the original article Hit count: 625

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.

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.

Here is what testdisk 6.14-WIP finds:

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.

What should I do?

© Server Fault or respective owner

Related posts about software-raid

Related posts about data-recovery