Directory structure for NFS shares + MergeRFS

Notice: Page may contain affiliate links for which we may earn a small commission through services like Amazon Affiliates or Skimlinks.

IamSpartacus

Well-Known Member
Mar 14, 2016
2,516
650
113
I'm setting up a media server on Ubuntu Server 16.04. I want to mount NFS shares from two "remote" storage arrays (shares are identical on both arrays, ie. Movies, Television, etc.) and use MergeRFS to merge both sets of mounted NFS shares together to be used by all my media dockers.

I'm looking for confirmation if I'm doing this correctly as I'm very new to both Linux and MergeRFS specifically. I've setup the following NFS mounts on the server:

/mnt/nfs/movies/array01_movies
/mnt/nfs/movies/array02_movies
/mnt/nfs/tv/array01_tv
/mnt/nfs/tv/array02_tv
/mnt/nfs/music/array01_music
/mnt/nfs/music/array02_music


From what I've read on @rubylaser's blog, I'd then use the following lines to create 3 pools for the sets of mounts:

/mnt/nfs/movies/* /movies fuse.mergerfs category.create=eplfs,defaults,allow_other,minfreespace=20G,fsname=mergerfsPool 0 00
/mnt/nfs/tv/* /tv fuse.mergerfs category.create=eplfs,defaults,allow_other,minfreespace=20G,fsname=mergerfsPool 0 00
/mnt/nfs/music/* /music fuse.mergerfs category.create=eplfs,defaults,allow_other,minfreespace=20G,fsname=mergerfsPool 0 00


This would give me directories of /movies, /tv, and /music to present to my dockers. Am I missing something here? Is there a better way of doing this that I'm overlooking?
 

rubylaser

Active Member
Jan 4, 2013
846
236
43
Michigan, USA
The first thing I would do is make sure that all of your permissions are good and consistent across the NFS mounts so that the entire folder structure shows up on the mergerfs end. Your NFS mounts look fine. I would change your /etc/fstab for the mounts a little bit though in regards to the fsnames (they should be different for each pool. Also, I don't like creating multiple mountpoints off root , so I would create a directory where all of these pools can co-exist.

Code:
sudo mkdir /storage/{tv,movies,music}
Then, change your /etc/fstab as follows.
Code:
/mnt/nfs/movies/* /storage/movies fuse.mergerfs category.create=eplfs,defaults,allow_other,minfreespace=20G,fsname=Movies 0 00
/mnt/nfs/tv/* /storage/tv fuse.mergerfs category.create=eplfs,defaults,allow_other,minfreespace=20G,fsname=TV 0 00
/mnt/nfs/music/* /storage/music fuse.mergerfs category.create=eplfs,defaults,allow_other,minfreespace=20G,fsname=Music 0 00
Good luck and let me know if you have any questions :)
 

rubylaser

Active Member
Jan 4, 2013
846
236
43
Michigan, USA
@rubylaser I haven't explicitly defined any permissions on the server itself. Is there a best practice for this?
You just need to make sure that each NFS mounted folder has the same permissions or some folders may prevent others from being visible. I normally chmod to 750 on my media shares so that the owner can read/write/execute, the group can read/execute, and others can do nothing. In your case since this is a media server with Docker containers, potentially with a few different users/groups trying to read/write to the pools, you may want to be less restrictive or even go crazy and start with 777 permissions to get everything working, then tighten them up. You will also want to set the owner/group for the folders so that things like Plex, Sonarr, Couchpotato, etc. can write to the folder as well.

I use Linuxserver.io Docker containers, and I set the user and group consistently across all of them, so that everything works properly.
 

IamSpartacus

Well-Known Member
Mar 14, 2016
2,516
650
113
You just need to make sure that each NFS mounted folder has the same permissions or some folders may prevent others from being visible. I normally chmod to 750 on my media shares so that the owner can read/write/execute, the group can read/execute, and others can do nothing. In your case since this is a media server with Docker containers, potentially with a few different users/groups trying to read/write to the pools, you may want to be less restrictive or even go crazy and start with 777 permissions to get everything working, then tighten them up. You will also want to set the owner/group for the folders so that things like Plex, Sonarr, Couchpotato, etc. can write to the folder as well.

I use Linuxserver.io Docker containers, and I set the user and group consistently across all of them, so that everything works properly.
Thanks @rubylaser. I will work on this today and report back my results this evening. Hoping to bring up a test plex docker or two this evening to see how mergerfs handles multiple nfs mounts with identical data.
 
  • Like
Reactions: Chuntzu

IamSpartacus

Well-Known Member
Mar 14, 2016
2,516
650
113
Ok I've got Plex up and running with the mergerfs mount points and I've tested adding one library (a small one so not much metadata would be created). I then disabled the NFS share on the primary array and can confirm that Plex doesn't even blink. It still thinks the data is there because the backup NFS share is still present and media playback still works! I also confirmed for sure that it is indeed streaming from the backup array as I see the data moving across my VPN connection (where the backup array sits).

Next thing I need to do is figure out the process to extend the size of the disk on the server as I started with only a 16GB vmdk for testing purposes but will need that to be at least 100GB going forward. Once I have that done I will setup the remainder of my dockers and then rsync the appdata folder from my current array where my dockers are running over to this new server.
 

rubylaser

Active Member
Jan 4, 2013
846
236
43
Michigan, USA
That sounds awesome. I knew the pooled NFS directories should work with mergerfs, I've just never tried it myself. I'm glad that it's working well.