playing with dd_rescue, loop device and mdadm

How to backup drive and examine mdadm over the image file using loop

Step 1:

Making backup with
dd_rescue /dev/#damaged_hdd /mountpoint/file

Step 2:

Print partitions with
losetup /dev/loop0 /mountpoint/file
fdisk -l -u /dev/loop0

first_storage_pv2_2_2.img2 160650 1945471499 972655425 fd Linux raid autodetect

Make a loopback dev with proper partition
losetup -o(start num*512) --sizelimit (end-start num*512) /loop[1-9] /mountpoint/file

Step 3:

mdadm --examine /dev/loop0

Additional commands
delete loop dev
losetup -d /loop[0-9]
assemble md array
mdadm --assemble --force /dev/md[0-9] /dev/device[s]

Suburban Glory Web Design