Recover RAID mirror disk from image file

Scenario

Failing hard disk in a 2 disk mirror, suspect disk problems as both disks seemed to suffer failures at the same time.

dd-recover used to copy each partition to an image file which needed mounting to allow data to be copied off for a holding filesystem.

Solution

You can't just mount the image file on it's own as it's part of a mirror (mdadm), so this won't be any good:- mount -o ro partition1_file.raw /tmp/partition1

This needs to be assembled to a single disk mirror:-

# mdadm --assemble --run /dev/md1 partition1-complete.raw 

But this won't work either as the raw file is not a device mdadm recognises, it needs to be mounted as a loop device with losetup and then assembled with mdadm:-

# losetup /dev/loop1 partition1-complete.raw 
# mdadm --assemble --run /dev/md1 /dev/loop1 
# cat /proc/mdstat

But for some reason, this command does not create a /dev/md1 device, it creates a md127 which it still thinks should be running, so the assemble command fails again. You need to stop the mirror array and then assemble it:-

# mdadm --stop /dev/md127
# mdadm --assemble --run /dev/md127 /dev/loop1
# cat /proc/mdstat 
# mount /dev/md127 /mnt/p1

And finally, you can mount the raw image as a filesystem.

This page has been accessed:-
Today: 1
Yesterday: 0
Until now: 282

 
linux/recover-raid-disk.txt · Last modified: 05/12/2022 14:47 by andrew