I've a friend with a NAS stuck in the firmware upgrade process, it is Linux based and I believe it use software raid-5 on 4 disks using mdadm /dev/md*.

The product customers support just told how to re-install the factory firmware but all the data will be lost.

The friend have contacted a professional recovery service but they're asking for some money (not cheap).

I'm quite confident with Linux (used to write firmware for embedded devices in the past) but not really with raid.

I'd like to attach the disks to a Debian pc and mount the raid as read-only, if I understand correctly there are good chances the raid and its configuration will be automatically detected by the kernel (or using mdadm), but how to be sure that no data is written to the disks and what are the steps to mount the raid ro?


Firstly plug the disks in and run:

mdadm --examine /dev/sdb1

After that, assuming they're readable, you should then be able to reassemble using:

mdadm --assemble /dev/md/... /dev/sdxn

If you're really worried, put the disks onto your host, then use a VM in a configuration where the user running the VM only has read access to the disks, but I doubt this will work since meta data on the disks needs to be updated.

Another thought comes to mind though, if you have the space, dd the disks locally and play with those files, or do something like this for preservation:

dd if=/dev/sdxN | gzip > /content/sdxN.gz

I had to do much less than expected.

Before attacching the disks I've installed mdadm package and used dpkg-reconfigure mdadm to disable anything automatic on any raid.

Once attached the disks the Debian's kernel (3.16.0-4-amd64) detected the raid at boot time.


Personalities : [raid6] [raid5] [raid4] [raid1] 
md126 : active (auto-read-only) raid1 sdb1[0] sdd1[3] sde1[2]
      20955008 blocks super 1.2 [4/3] [U_UU]

md127 : active (auto-read-only) raid5 sdb2[0] sdd2[3] sde2[2] sdc2[1]
      5797132800 blocks super 1.1 level 5, 512k chunk, algorithm 2 [4/4] [UUUU]

unused devices: <none>

I don't know what md126 is, the correct one is md127.

I tried to mount /dev/md127 into a temporary directory but failed with error: mount: unknown filesystem type 'LVM2_member'

I've installed lvm2 package and used lvmdiskscan and lvdisplay commands to show the interesting volume.

# lvmdiskscan
  /dev/14b46bb0_vg/lv53a3800a [       5,40 TiB] 

# lvdisplay

  --- Logical volume ---
  LV Path                /dev/14b46bb0_vg/lv53a3800a
  LV Size                5,40 TiB

Then just mounted and that's it.

mount -o ro /dev/14b46bb0_vg/lv53a3800a /tmp/raid/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.