MergerFS on Ubuntu 20.04

This post for my own references, is made thanks to this great article.

https://www.teknophiles.com/2018/02/19/disk-pooling-in-linux-with-mergerfs/

Start by downloading the latest version, for me it is the mergerfs_2.31.0.ubuntu-bionic_amd64.deb file:

wget https://github.com/trapexit/mergerfs/releases/download/2.31.0/mergerfs_2.31.0.ubuntu-bionic_amd64.deb

Then simply install it using dpkg:

dpkg -i mergerfs_2.31.0.ubuntu-bionic_amd64.deb 

Following the install, you can easily mount separate mounted HDDs into a common containing folder.

root@lisa:/mnt# 
root@lisa:/mnt# 
root@lisa:/mnt# pwd
/mnt
root@lisa:/mnt# ls -l
total 8
drwxr-xr-x 3 root root 4096 Oct 13 15:14 SATA.2.WD-Red.3TB-1
drwxr-xr-x 3 root root 4096 Oct 13 15:14 SATA.3.WD-Red.3TB-2
root@lisa:/mnt# mkdir virtual
root@lisa:/mnt# mergerfs -o defaults,allow_other,use_ino,fsname=mergerFS /mnt/SATA.2.WD-Red.3TB-1:/mnt/SATA.3.WD-Red.3TB-2 /mnt/virtual
root@lisa:/mnt# 
root@lisa:/mnt# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            3.9G     0  3.9G   0% /dev
tmpfs           795M  1.1M  794M   1% /run
/dev/sda2       229G  6.6G  210G   4% /
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/loop0       98M   98M     0 100% /snap/core/10126
/dev/loop1       89M   89M     0 100% /snap/core/7270
/dev/sdb1       2.7T   89M  2.6T   1% /mnt/SATA.2.WD-Red.3TB-1
/dev/sdc1       2.7T   89M  2.6T   1% /mnt/SATA.3.WD-Red.3TB-2
tmpfs           795M     0  795M   0% /run/user/1000
mergerFS        5.4T  177M  5.1T   1% /mnt/virtual
root@lisa:/mnt# 

So far using mergerFS has proved easy, and very flexible. Finally we can use /etc/fstab to mount these at boot time. We can use wildcards to include the drive mount points as below:

root@lisa:/mnt# more /etc/fstab
UUID=42e23971-b35d2-4b5f-a5a5-2ade6bf39eee / ext4 defaults 0 0
# SDB1 on Slot 2
UUID=38175b20-4394-4c42-b14f-cdefw3bf4524 /mnt/SATA.2.WD-Red.3TB-1 ext4 defaults 0 0
# SDC1 on Slot 3
UUID=66ef6909-b715-4c80-ec91-acf6e734bf15 /mnt/SATA.3.WD-Red.3TB-2 ext4 defaults 0 0

# <file system>           <mount point>      <type>         <options>                                      <dump>  <pass>
/mnt/SATA.?.WD-Red.3TB-?  /mnt/virtual       fuse.mergerfs  defaults,allow_other,use_ino,fsname=mergerFS   0       0

Please consider visiting https://www.teknophiles.com/2018/02/19/disk-pooling-in-linux-with-mergerfs/ for a complete introduction.