Mount Unraid data disks as one on Linux with MergerFS

A tutorial on how to mount and merge all of your existing Unraid data disks on another Linux distro using MergerFS without losing any data.

Mount Unraid data disks as one on Linux with MergerFS
Unraid CLI

I ran into a situation recently where I wanted to move a backup array containing a large amount of data from Unraid to a regular Linux distro such as Debian without losing any data.

Lucky for me, Unraid handles each disk in an array as an independent disk and filesystem, this process turned out to be trivial. Some details are needed from the Unraid side prior to booting another distro to make this process smooth and easy.

In another post, I'll go over adding Snapraid to this setup to create parity disks for the existing data.


The Unraid side

First grab and store some information about your data disks from unraid that you'll need to add to the other distro's /etc/fstab entries for each Unraid data disk.

Get a list of your data disks

lsblk

lsblk will list all of your disks attached to the system. Note down each disk that's in your data array. The data array disks should show mount points similar to /mnt/disk1.

root@unraid:/# lsblk
NAME                           MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sda                              8:0    0  7.3T  0 disk
└─sda1                           8:1    0  7.3T  0 part /mnt/disk3
sdb                              8:16   0  7.3T  0 disk
└─sdb1                           8:17   0  7.3T  0 part /mnt/disk6
sdc                              8:32   0  7.3T  0 disk
└─sdc1                           8:33   0  7.3T  0 part /mnt/disk1
sdd                              8:48   0  7.3T  0 disk
└─sdd1                           8:49   0  7.3T  0 part /mnt/disk2
sde                              8:64   0  7.3T  0 disk
└─sde1                           8:65   0  7.3T  0 part /mnt/disk4
sdf                              8:80   0  7.3T  0 disk
└─sdf1                           8:81   0  7.3T  0 part /mnt/disk5

Find the UUID for each of the data disk partitions

This example is /dev/sdb mounted at /mnt/disk6 shown above. This is the last data disk in my Unraid data array.

Change "sdb" to each of your data disks partition 1. Example: "blkid /dev/sdb1"

root@unraid:/# blkid /dev/sdb1
/dev/sdb1: UUID="e99fa3c6-8852-433e-8b1d-95f11db4344b" BLOCK_SIZE="512" TYPE="xfs" PARTUUID="4c535176-862b-4f58-a065-e7e61cc1a910"

The part we care about here is the UUID:

UUID="e99fa3c6-8852-433e-8b1d-95f11db4344b"

Mount Options

Putting together the /etc/fstab entries will need similar mount options. Change "sdb" to one of your data disks. Example "cat /proc/mounts | grep /dev/sdb1"

Gather the mount options from Unraid for a given data disk with the following:

cat /proc/mounts | grep /dev/sdb1

This returned:

root@unraid:/# cat /proc/mounts | grep /dev/sdb1
/dev/sdb1 /mnt/disk6 xfs rw,noatime,attr2,inode64,logbufs=8,logbsize=32k,noquota 0 0

The part here that we care about is:

xfs rw,noatime,attr2,inode64,logbufs=8,logbsize=32k,noquota 0 0

You really only need to do this with one disk if all of your disks are the same filesystem type. All of mine in this case are XFS.

Put together the /etc/fstab entries for each data disk

Take the UUID, the mount point, and the mount options and create an fstab entry. On the Linux distro I'll me mounting these disks sequentially from the exact same order as Unraid, so my mount points will look like "/mnt/disk#" for each disk in the next steps. I'm preparing the fstab entries to account for this.

Do this for each of your Unraid data disks and store somewhere such as Notepad++. In the next step, you'll boot your foreign Linux Distro on the same system with these disks and add this info to /etc/fstab.

UUID=c92114f5-9a5d-4d10-ab8d-b531a21efbc0 /mnt/disk3 xfs rw,noatime,attr2,inode64,logbufs=8,logbsize=32k,noquota 0 0

Boot your new distro

I'll be using Debian latest for this part as my plan was to move from Unraid to Debian for this storage. Once fully installed and booted from another boot media, continue on.

Install dependencies

I'm installing xfsprogs to get xfs tools (you may not need this if you have a different filesystem for your data disks) and mergerfs.

apt-get update
apt-get install xfsprogs mergerfs

Modify /etc/fstab - Add all entries for data disks and MergerFS entry

Your entries should look different - UUID's will be unique to your system and you may have a different number of disks. These mount points are the ones created in the above step and then also the MergerFS mount point. I mount each disks as /mnt/disk# in order to simplify the MergerFS mount.

My MergerFS mount in this case is /mnt/backup-data. You can change this to match how you want your environment configured.

nano /etc/fstab
...

# Data Disks used by MergerFS - these will be all data disks

UUID=246ccf5d-7645-4310-b2c1-74190427b4a1 /mnt/disk1 xfs rw,noatime,attr2,inode64,logbufs=8,logbsize=32k,noquota 0 0

UUID=2aaaefdc-d364-42d4-b586-c2310f0968b1 /mnt/disk2 xfs rw,noatime,attr2,inode64,logbufs=8,logbsize=32k,noquota 0 0

UUID=c92114f5-9a5d-4d10-ab8d-b531a21efbc0 /mnt/disk3 xfs rw,noatime,attr2,inode64,logbufs=8,logbsize=32k,noquota 0 0

UUID=5515dc1a-ef7e-4605-b519-f4f5dd591d04 /mnt/disk4 xfs rw,noatime,attr2,inode64,logbufs=8,logbsize=32k,noquota 0 0

UUID=1dbb9aee-7e63-4592-a549-55b83922c950 /mnt/disk5 xfs rw,noatime,attr2,inode64,logbufs=8,logbsize=32k,noquota 0 0

UUID=e99fa3c6-8852-433e-8b1d-95f11db4344b /mnt/disk6 xfs rw,noatime,attr2,inode64,logbufs=8,logbsize=32k,noquota 0 0

# MergerFS
/mnt/disk* /mnt/backup-data fuse.mergerfs defaults,nonempty,allow_other,use_ino,cache.files=off,moveonenospc=true,category.create=mfs,dropcacheonclose=true,minfreespace=250G,fsname=mergerfs 0 0

...

/etc/fstab

Create all mount points

Modify for the correct number of disks you have.

# Data disk mount points
mkdir -p /mnt/{disk1,disk2,disk3,disk4,disk5,disk6}

# MergerFS mount point
mkdir -p /mnt/backup-data

Mount all data disks and MergerFS

This method will refresh for /etc/fstab changes and then mount all disks and MergerFS.

systemctl daemon-reload
mount -a 

Another option is to reboot the system.

Validate successful mount

Check to see that a MergerFS Filesystem shows mounted on the mount point created earlier when running "df -h" and that all data disks show mounted for each mount point created earlier for the amount of disks you have coming from Unraid to Debian (or any other distro).

root@backup-storage:/# df -h
Filesystem                            Size  Used Avail Use% Mounted on
udev                                   32G     0   32G   0% /dev
tmpfs                                 6.3G  1.9M  6.3G   1% /run
/dev/mapper/backup--storage--vg-root   27G  1.2G   24G   5% /
tmpfs                                  32G     0   32G   0% /dev/shm
tmpfs                                 5.0M     0  5.0M   0% /run/lock
mergerfs                               44T  9.9T   34T  23% /mnt/backup-data
/dev/sdf1                             7.3T  1.5T  5.8T  21% /mnt/disk5
/dev/sdb1                             7.3T  1.5T  5.8T  21% /mnt/disk6
/dev/sdg2                             456M   59M  372M  14% /boot
/dev/sdd1                             7.3T  1.5T  5.8T  21% /mnt/disk2
/dev/sdc1                             7.3T  2.4T  5.0T  33% /mnt/disk1
/dev/sda1                             7.3T  1.5T  5.8T  21% /mnt/disk3
/dev/sde1                             7.3T  1.5T  5.8T  21% /mnt/disk4
/dev/sdg1                             511M  5.9M  506M   2% /boot/efi
tmpfs                                 6.3G     0  6.3G   0% /run/user/0

For me, this all worked out and the data disks mounted with no issue. MergerFS put it all back togther using the config created (Merged) just as it was in Unraid and is now accessible as a single mount point.

I then was able to access the merged filesystem at /mnt/backup-data.