HOWTO: recover data from RAID1
Scenario: two or more HDs configured as RAID1. One of them gets broken and the computer doesn’t boot for any reason.
Problem: access data in the partition to recover them. It is not possible to mount it directly because it is a RAID partition, so:
- Create an image of the good disk using
ddand secure it - Take another pc with debian/ubuntu (or similar distro)
- Using an usb<->sata adapter, plug the disk in the new computer and make note of the device checking the output using
dmesg(eg./dev/sdc) - Verify with
fdisk/cfdiskthe partition table of the disk: there should be one or moreraid autodetectpartitions -
Open a terminal and type
$ mdadm --assemble --run /dev/md0 /dev/sdc1to create a temporary RAID1 and to make it available using
/dev/md0 -
If it doesn’t work, maybe the RAID kernel module is not loaded.
$ modprobe raid1and try again
-
If everything is OK, it will be possible to mount
/dev/md0:$ mount /dev/md0 /mnt -
If the above command gives back
invalid argument, likely the ext3 module is not loaded.$ modprobe ext3and try again
- If mount hasn’t given back any error, it will be possible to mount to access data in the raid1 from
/mnt - Save all you can save
Umount /mnt-
Stop the temporary raid1 using
$ mdadm --stop /dev/md0 -
If necessary, repeat the same process with the other partitions
$ mdadm --assemble --run /dev/md1 /dev/sdc2 - Done
WARNING: if you have a RAID5, this procedure won’t work.
Many thanks to Lorenzo
Comments