Skip to content

HowTo mount RAID disks in Debian

When I migrated from a QNAP NAS to a custom-built NAS which now serves as nfs storage for my cluster, I needed to copy over the data from my QNAP disks before I could re-purpose them in the new NAS. Transferring the data over network was going to take a lot of time... so I tried to mount the disks directly inside the freshly installed Debian OS. All in all this was a bit harder than anticipated, so I documented my steps.

Note

This guide may not work for every RAID setup, but can still provide a reference for similar use-cases.

Steps

Dependencies

First we need to install mdadm and lvm2 packages. On debian you can do this by running:

sudo apt install -y mdadm lvm2

Activate and mount the Volume Group

Info

NB! All the following commands need sudo

Then run the following command to assemble the array:

mdadm --assemble --scan

Now we can scan the logical volumes with:

lvscan
  WARNING: PV /dev/md2 in VG vg288 is using an old PV header, modify the VG to update.
  inactive            '/dev/vg288/lv545' [144.12 GiB] inherit
  inactive            '/dev/vg288/lv2' [16.22 TiB] inherit

Tip

Can also run vgdisplay to show things in a more human-readable format.

The volume group is vg288, so now we might need to activate it, if it's inactive, with:

vgchange -ay vg288

Re-run vgscan to see that volume group is now active:

  WARNING: PV /dev/md2 in VG vg288 is using an old PV header, modify the VG to update.
  ACTIVE            '/dev/vg288/lv545' [144.12 GiB] inherit
  ACTIVE            '/dev/vg288/lv2' [16.22 TiB] inherit

Now create the mount point and mount the volume group:

mkdir /mnt/qnapvolume
mount /dev/vg288/lv2 /mnt/qnapvolume

The data will now be available under /mnt/qnapvolume

Unmount and deactivate the volume group

First unmount the mount-point:

umount /mnt/qnapvolume

To deactivate the volume group run:

vgchange -an vg288

Then stop the array:

mdadm --stop --scan

After this one can power-off the drive with:

Note

This command does not need sudo

udisksctl power-off -b /dev/sdX

where X is the device number

References