MergerFS
This is a FUSE utility that merges multiple individual filesystem disks into one large filesystem. It shines when you have a random collection of disks and can’t use RAID. It also tolerates failure as even if you loose a disk, the data on the remaining are still available normally.
When combined with SnapRAID, you can even recover.
Installation
The developer recommends users install the most recent version available from the releases page as the Debian repos can be very out of date.
Navigate to https://github.com/trapexit/mergerfs/releases, download, and then:
sudo dpkg -i mergerfs*
Configuration
# First, format your disks and give each of them their own mount point
wipefs -a /dev/sda
mkfs.ext4 /dev/sda
blkid /dev/sda
... repeat for each disk and note the UUID
# Mount them all permanently
mkdir -v /mnt/disk-{1..4}
echo "UUID=c3659080-ce25-4c13-bc96-016959f1e097 /mnt/disk-1 ext4 defaults,noatime 0 0" >> /etc/fstab
echo "UUID=3cf40be6-647f-4dbe-a617-fb0a2b7b6b9e /mnt/disk-2 ext4 defaults,noatime 0 0" >> /etc/fstab
... and so on
mount --all
# Install MergerFS, create a mount point for it and add a final line to the fstab
sudo apt install mergerfs
mkdir /mnt/pool
echo "/mnt/disk* /mnt/pool fuse.mergerfs cache.files=off,category.create=mfs,func.getattr=newest, 0 0" >> /etc/fstab
According to the developer1, the basic FUSE options above work for most cases if you’re on a recent kernel uname -r > 6.6.
| cache.files | off | Let the OS handle caching, so as to not double-cache things |
| category.create | mfs | Space allocation - see below |
| func.getattr | newest | Make directory tree mod times accurate so changes are detected2 |
Note:
The default space allocation used to keep folder contents together. This is good for some types of content, but deep directory trees could become unbalanced and run out of space early. So we changed to mfs which is simply ‘most free space’.
The default category.create may work better now that it’s changed and the [other policies] are interesting to read. There are also [other options] for fuse.
The docs also recommend starting with dropcacheonclose=false but that defaults to false anyway, so i’ve left it out.
[[other policies]:https://trapexit.github.io/mergerfs/latest/config/functions_categories_policies/#policy-descriptions [other options]:https://trapexit.github.io/mergerfs/latest/config/options/#mount-options
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.