Merge multiple drives into a virtual file system

I have five drives with the same file structure and I want to merge them to see all the contents in a single folder.

I’ve taken a look at mergefs and I’m not sure what command do I have to use to do this.

It says in the BASIC SETUP that I can use this options to start if I don’t need mmap, which I’m assuming I don’t need because I don’t know what it is:

allow_other,use_ino,cache.files=off,dropcacheonclose=true,category.create=mfs

And so I guess the command would be:

mergerfs -o allow_other,use_ino,cache.files=off,dropcacheonclose=true,category.create=mfs /mnt/V:/mnt/W:/mnt/X:/mnt/Y:/mnt/Z /mnt/storage

Also I want to know what would happen to the files which paths would be the same.

Also what do I need to install in manjaro to mount this through fstab? It says

for mounting via fstab to work you must have mount.fuse installed. For Ubuntu/Debian it is included in the fuse package.

And after that the fstab line would be like this?

# <file system>        <mount point>  <type>         <options>             <dump>  <pass>
/mnt/V:/mnt/W:/mnt/X:/mnt/Y:/mnt/Z  /mnt/storage      fuse.mergerfs  allow_other,use_ino,cache.files=off,dropcacheonclose=true,category.create=mfs   0       0

Hi @Individual-Heart-719,

I have never worked with mergefs but I have worked with aufs in the past, so take a look at that:

Hope this helps!

2 Likes

Well as I understand, if paths match exactly, it will read from the first and newest match. And if you write it, it will be written to the storage with most space.

fuse is installed by default. No worries, otherwise you you cannot use mergerfs in the terminal manually.

But note: Mergerfs is a good tool, but I would rather say it is experimental and not widely used.

If you need to merge folders, then use overlayfs or the older one: unionfs. But it will write changes to different folders.

I had taken a look at overlayfs before this one because it’s included in the kernel by default but it says it has only the option of an upper folder and a lower folder, so I couldn’t use it with five upper folders right?

Correct… you can use as much lower folders as you like and only one upper folder, where all changes will be written. In my view it is much saver and simpler. The only difference between both overlay systems is the write policy, where mergerfs have more options, but I would not trust it. Only if you know what you are doing.

Anyway… you can use mergerfs, but I would rather suggest to use mdadm RAID0 or as I use: BTRFS with subvolumes as a JBOD or RAID0, but yeah you need to make backups (since less secure, but high speed).

rclone has the option to create a merged mount where you can mount any (supported) filesystem.
The type is called union.

The relevant config is here:

[source_x]
type = local

[source_y]
type = local

[merged]
type = union
upstreams = source_x:/mnt/X source_y:/mnt/Y

Then, you mount it
rclone mount merged /mnt/merged

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.