I have a 2 disk NAS device using RAID 1 mirroring. When disks started failing I wanted to buy bigger disks so as to upgrade the volume size. However the device couldn't handle mirroring the original data from the smaller hard drive to the bigger drive. So my plan is to mount one of the old raid disks (keeping the other as an emergency backup) on an Ubuntu machine and just copy the data to the new, larger, RAID array in my NAS device.

How do I mount a single disk from the raid array on an Ubuntu machine to retrieve data from it?

--- different question, same answer ---

I have a 2 disk NAS device using RAID 1 mirroring. I have three disks. Periodically I swap a disk out of the NAS device to keep it in a safe place as a backup. The NAS device then automatically mirrors the existing data to the new disk.

If my house burns down, how would I mount the backup disk from the raid array on an Ubuntu machine to retrieve data from it?

--- More information ---

With the single hard disk mounted in my Ubuntu machine, fdisk -l reports:

Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
    Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: D1C4E003-11FD-4223-AA98-61CB9C6322BD

Device          Start        End    Sectors  Size Type
/dev/sdb1        2048    1050623    1048576  512M Linux swap
/dev/sdb2     3147776 3904929899 3901782124  1.8T Microsoft basic data
/dev/sdb3  3904931840 3907029134    2097295    1G Microsoft basic data
/dev/sdb4     1050624    3147775    2097152    1G Microsoft basic data

I tried steps from a similar question on this site:

root@host:/mnt# mount /dev/sdb2 /mnt/old_nas/
mount: /mnt/old_nas: unknown filesystem type 'linux_raid_member'.

root@host:/mnt# mdadm --assemble --run /dev/md0 /dev/sdb2
mdadm: failed to RUN_ARRAY /dev/md0: Invalid argument
mdadm: Not enough devices to start the array.

This must be quite a common thing to want to do so I am surprised not to already find a fully working answer.


Let's supose /deb/sdb2 is the old raid 1 member you want to recover.

First option: try to reassemble the RAID 1 with the old disk:

You need to assemble the degraded RAID array in the new machine, using something like this:

mdadm --force --assemble --run /dev/md0 /dev/sdb2

Of course, pick a number besides md0 if that's already in use. Then you can mount /dev/md0 wherever you want.

Another option:

mdadm --force --run --assemble --scan

You will get something like this:

mdadm: /dev/md/0 has been started with 1 drive (out of 2)

Then mount and see your files:

cd /mnt && mkdir md0 && mount /dev/md0 md0
ls -la md0

Finally, you can add a second drive to the array:

mdadm /dev/md0 --manage --add /dev/sdc1

Second option: using a read-only loop device

Get the data offset for the old disk:

mdadm --examine /dev/sdb2 | grep -i offset

Create the loop device (let's imagine data offset is 2048):

losetup --find --show --read-only --offset $((2048*512)) /dev/sdb2

Mount the printed loop device resulting from previous command

mount -o ro /dev/loo1 /mnt/

Mount might be able do this directly with the -o ro,loop,offset= options:

mount -o ro,loop,offset=$((2048*512)) /dev/sdb2 /mnt

As far as I am concerned, the issue you are facing with might be due to mdadm considers your RAID 1 array "clean", which is not the case. Before removing the disk from the array, you should explicitly tell mdadm that your second (sdb2) disk has failed:

mdadm --manage /dev/md0 --fail /dev/sdb2
mdadm --manage /dev/md0 --remove /dev/sdb2
  • My previous attempts to assemble the raid, or possibly something else, are resulting in the disk being automatically mounted (wrongly) on boot. How do I stop that? – AlastairG Oct 18 '20 at 7:49
  • The first option gives the same result as in my question: mdadm: Not enough devices to start the array.. The second option gives mdadm: /dev/md/1 assembled from 0 drives and 1 spare - not enough to start the array. – AlastairG Oct 18 '20 at 7:53
  • Please, try adding the --force option to mdadm commands. Another option is this: mount -o ro,loop,offset=$((2048*512)) /dev/sdb1 /mnt/ (replace sdb1 with your raid 1 disk and partition). – Jesús Ángel Oct 18 '20 at 8:33
  • I have updated my answer. Please, read it again. – Jesús Ángel Oct 18 '20 at 9:21
  • Thanks. I will try that. I am not sure what you mean by "removing the disk from the array". There is (currently) no array, is there? – AlastairG Oct 18 '20 at 9:39

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.