How to retrieve data from RAID Volumes on Linux
From SynologyWiki
Guide adapted from user Noctec on the German community forum
Contents |
Background
1. The Cube Station has three partitions: System, SWAP, and Data.
2. The Cube Station uses a big endian system. To mount the system on a Linux PC it must be converted to little endian.
3. The Cube Station uses the EXT3 file system.
Preparation
1. The Linux must have a 4-Port SATA controller installed, the function of the controller should be tested with a HDD.
2. "Multi-device support (RAID 0/1/5)" must be activated in the Linux Kernel.
*Check if the file "/proc/mdstat" is present to verify raid support of the Kernel.
Duplicating the Raid Disks
If you are attempting to retrieve data from damaged or corrupted disks, it is recommended to create a duplicate of the disk first, and attempt to retrieve data from the duplicated disks. This is an optional step, but it is highly, strongly recommended to execute. Please note that you will need identical capacity (same model recommended) and quantity of disks to execute this procedure.
1. Connect one Cube Station Disc (sda) and one empty disc (sdc) to the controller.
2. Backup your HDD with this command:
dd if=/dev/sda of=/dev/sdc bs=64k conv=noerror
ATTENTION: This command will irreversibly erase the destination disk. If you copy in the wrong direction, there is no way to get your data back.
- You have to repeat this procedure for every disk. After that you have another set of disks and can try to retrieve the data without risk.
Data recovery
1. Connect the four drives from the Cube Station to the SATA controller. The HDD's will be recognized as sda, sdb, sdc, and sdd. It's easier if you attach the drives in the same sequence as in the Cube Station. Else you have to change the identifications.
2. Update the super blocks to little endian
- 4 disks RAID 0 or RAID 5:
mdadm -A /dev/md2 --update=byteorder /dev/sd[abcd]3
- 2 disks RAID 1:
mdadm -A /dev/md2 --update=byteorder /dev/sd[ab]3
3. After that a md2 device appears in Linux. The devices can be viewed with the following command:
cat /proc/mdstat
- A 4-Disc RAID-5 Volume needs at least 3 discs for data recovery
- A 3-Disc RAID-5 Volume needs at least 2 discs for data recovery
4. If the instructions above didn't create a md2 device, you can try to force the device creation:
mdadm -Sf /dev/md2 mdadm --assemble --force /dev/md2 /dev/sd[a-d]3
5. After the raid rebuild the partitions can be mounted.
mount –o ro /dev/md2 /mnt
6. If mounting does not work, you can try another super block:
mount –o ro,sb=131072 /dev/md2 /mnt
or
mount –o ro,sb=393216 /dev/md2 /mnt
7. If mounting does still fail, you can try to run fsck.ext3 and then retry to mount.
- Before running fsck, you should make a backup of the HDD's, because fsck can make the condition worse. You will need another set of HDD's for that.
