Mounting storage NOT on same FreeNAS server

BigPapaPSP

Dabbler
Joined
Jan 24, 2019
Messages
20
Migrated my previous FreeNas installation over to new hardware. Have a dual node box. One one node, FreeNAS 11.2, running my large z2 nas. Including dataset called PlexMedia with sub directories for movies, series, photo, music, etc....

On the 2nd node in the machine, I have another installation of FreeNas 11.2 running. Two hard drives, mirrored together. This server was geared to be a replication host to receive a mirror copy of another dataset on the other Freenas server (PersonalFiles) as well as to be my application server.

I want to install Plex, and a few other apps (CouchPotatoe, Headphones, Sickbeard, and NZBGet) on the apps server. I've installed plex, but trying to mount my libraries...

Since the media files exist on the other freenas server i'm out ideas.

RECAP:

Server: FreeNas01 -- Running Large Pool with two datasets
/mnt/PlexMedia (All my media files)
/mnt/PersonalFiles

Server: FreeNas02 -- Running two mirrored drives.
Want to install plex with storage mounts to other server... FreeNas01/PlexMedia

Any ideas on how to accomplish this?

D
 

Ixian

Patron
Joined
May 11, 2015
Messages
218
The normal way would be to use an NFS mount in your jails, have you not tried that, or are having trouble?
 

BigPapaPSP

Dabbler
Joined
Jan 24, 2019
Messages
20
Honestly I'm not that familiar with all the command line stuff... can you point me to a few examples? or a wiki on it?
 

Ixian

Patron
Joined
May 11, 2015
Messages
218
You can do most of it from the GUI on both servers.

Basically, you want to:
Enable the NFS server on FreeNAS01.
Create an NFS share on FreeNAS01 pointing to the dataset on that server you want to share (presumably the one that has your media in it)
Mount said NFS share to a folder on FreeNAS02. Probably better, in this case, to mount it in the jail itself.

Something like this:

Assumptions (adjust as needed) -
FreeNAS01 - Your data (media, I assume) source
FreeNAS02 - Your application server that needs access to the above

Connected via 1GBe link (assume)
Private, internal network space

On FreeNAS01:

  • Enable the NFS server if it isn't > GUI>Services>NFS and configure to auto-start.
  • Configure NFS server (pencil icon to the right). The defaults are fine, you can tune if needed later.
    • I recommend checking "NFS4" and then checking the "NFSv3 ownership model for NFSv4 " box. NFS4 is more performant, both servers support it, and it handles things like file-locking better than NFS3. However NFS4 by default has a stricter permissions model that, while useful, is unneeded for this use case and can complicate things, hence the option to use the NFSv3 ownership model.
  • GUI > Storage > Pools. Find the dataset you want to share (the one with your media in it). Check what user/group has permission to said dataset.
  • GUI > Accounts > Users/Groups. Take note of the GID and UID of the group/user that has permissions to said dataset.
  • GUI > Sharing > Unix (NFS) Shares. Create NFS share for the dataset on FreeNAS01 that you want FreeNAS02 to be able to access.
    • Select the dataset you want to share at the top.
    • The share defaults are fine, but click Advanced and look for Mapall Group and Mapall User (NOT Maproot). Set these to the same user/group that has permissions to the dataset itself.

What this will do is simple: Any remote NFS user accessing this share will have the same rights as the user/group specified - which will be the user/group with the permissions for the dataset.

(There are cases where you would want to use Maproot instead, or nothing at all, but "sharing media over a private network" isn't one of them).

On FreeNAS02:


Open a console (or ssh in to one) to your server.
Console in to your jail (technically we could use iocage exec to do this outside the jail but let's keep it straightforward).
iocage console <jailname>. I.e. if your Plex jail is named "plex" use that for jailname.

Create a directory in to mount the NFS share in - convention is to use something under /mnt but you can create it and call it whatever you like. Example:
mkdir -p /mnt/remote_media

Grant the user/group Plex runs as ownership of this directory. If you are using one of the default installs, the user/group in the jail is "plex".

chown plex:plex /mnt/remote_media

Manually mount the remote NFS share to the directory you created above to test.

mount -t nfs <server IP>:/path/to/share /mnt/remote_media

Where <server IP> is obviously FreeNAS01's ip (don't forget the : after) and /path/to/share is the path to the data set on FreeNAS01.

Example: You have a "media" dataset in the pool "tank" on FreeNAS01, ip 192.168.0.2 and you want that to mount to /mnt/remote_media on FreeNAS02:

mount -t nfs 192.168.0.2:/mnt/tank/media /mnt/remote_media

Assuming all went well you should now be able to browse to /mnt/remote_media inside your jail FreeNAS02 and see everything that is in the remote directory.

Test permissions/access
Code:
cd /mnt/remote_media
ls -l
touch test.txt
chown -R plex:plex test.txt
rm test.txt


If everything is fine, congrads, your Plex server will now be able to see the media directory, just point it to /mnt/remote_media (or wherever you mounted/called it).

Now add it to fstab so the storage remounts on boot. Iocage handles jail fstab outside of the jail itself so first exit it, then run the exec command on the jail like so:

Code:
exit ## back to Freenas console
iocage fstab -a <jailname> <Server IP>:/path/to/share /mnt/remote_media nfs rw 0 0


Where "jailname" is plex, or whatever your plex jail is named and Server IP, paths, are the same as the mount command you did above.

Restart the jail
iocage restart <jailname>

And make sure the directory you mounted is still there.

This should get you started. I can't guarentee it is 100% cut&paste since I am doing it from memory, and really you should use this as a guide to learning more vs. something to blindly follow anyway.

Also you may find you need to tune the NFS mount a bit - increase wait time, etc. - because remote NFS mounts can lock up your jail if, for example, your remote server disconnects. Once you get the basics working it's worth investigating. And you'll be able to ask more specific questions if you need help.
 

BigPapaPSP

Dabbler
Joined
Jan 24, 2019
Messages
20
Everything went fine UNTIL I went to mount

Code:
mount -t nfs 10.10.0.10:/mnt/MediaArray/PlexMedia /mnt/PlexMedia_FreeNAS01


returns: mount_nfs: nmount: /mnt/PlexMedia_FreeNAS01: Operation not permitted

YES, my pool is called MediaArray (upper and lower case), and yes PlexMedia is upper and lower case, as well as PlexMedia_FreeNAS01 directory on FreeNAS02

Any ideas? Thanks so much for the help!!! I think this is what stopped my previous attempts -- I had seen this operation not permitted error previously.
 

Ixian

Patron
Joined
May 11, 2015
Messages
218
Is this the Plex plugin (which is a pre-packaged iocage jail) or did you create your own iocage jail and install Plex in it?

If the latter, try sudo mount first. If sudo isn't installed in the jail pkg update && pkg upgrade then pkg install sudo

You can also try mounting outside the jail, from Freenas itself. For the mount directory, point it to the external path for the jail, like:

<jailroot>/plex/root/mnt/PlexMedia_FreeNAS01

where <jailroot> the path to the jails pool & dataset on FreeNAS02. i.e. /mnt/ssd/iocage/jails/plex/root/mnt/PlexMedia_FreeNAS01 assuming <ssd> is the pool for your jails.

If that works and sudo didn't then likely an nfsclient issue in the jail itself.
 

Ixian

Patron
Joined
May 11, 2015
Messages
218
You know, looking in to this a bit more (been a while since I've done it) I'm thinking mounting it outside the jail is the best approach. Mounting NFS shares inside jails seems to be problematic.

You could mount the remote NFS share to a common directory in Freenas proper, then just add that local directory as a mount point to your jail via the GUI. Other jails could use this as well (for example, CouchP and Sickbeard will need to transfer downloads from NZBGets' download directory to your media share, presumably).

Also, look at Radarr and Sonarr vs CouchP and Sickbeard.
 

Ixian

Patron
Joined
May 11, 2015
Messages
218
For example, in Freenas proper (not inside a jail) create a directory for the remote mount on FreeNAS02:

mkdir -p /mnt/<pool>/PlexMedia_FreeNAS01

Then
mount -t nfs 10.10.0.10:/mnt/MediaArray/PlexMedia /mnt/<pool>/PlexMedia_FreeNAS01

Then for your Plex jail just add /mnt/<pool>/PlexMedia_FreeNAS01 as a mount point like normal.

If it works don't forget to add the mount to FreeNAS02's fstab.
 

BigPapaPSP

Dabbler
Joined
Jan 24, 2019
Messages
20
Is this the Plex plugin (which is a pre-packaged iocage jail) or did you create your own iocage jail and install Plex in it?

If the latter, try sudo mount first. If sudo isn't installed in the jail pkg update && pkg upgrade then pkg install sudo

You can also try mounting outside the jail, from Freenas itself. For the mount directory, point it to the external path for the jail, like:

<jailroot>/plex/root/mnt/PlexMedia_FreeNAS01

where <jailroot> the path to the jails pool & dataset on FreeNAS02. i.e. /mnt/ssd/iocage/jails/plex/root/mnt/PlexMedia_FreeNAS01 assuming <ssd> is the pool for your jails.

If that works and sudo didn't then likely an nfsclient issue in the jail itself.

It is the pre-packaged, PlexPass Version.
 

BigPapaPSP

Dabbler
Joined
Jan 24, 2019
Messages
20
You know, looking in to this a bit more (been a while since I've done it) I'm thinking mounting it outside the jail is the best approach. Mounting NFS shares inside jails seems to be problematic.

You could mount the remote NFS share to a common directory in Freenas proper, then just add that local directory as a mount point to your jail via the GUI. Other jails could use this as well (for example, CouchP and Sickbeard will need to transfer downloads from NZBGets' download directory to your media share, presumably).

Also, look at Radarr and Sonarr vs CouchP and Sickbeard.

Thanks, can you give me a few steps to make it a mount point on the server instead of the jail... persistent?

I've been on sickbeard for years. Tried Sonarr and radarr, and was not a fan...
 

Ixian

Patron
Joined
May 11, 2015
Messages
218
That's what I did in post #8. Create directory in pool, use that as the mount point, and when you confirm it works, add that to the server fstab (vi /etc/fstab).

Then for the jail, just create a mount point to that directory like normal.
 

BigPapaPSP

Dabbler
Joined
Jan 24, 2019
Messages
20
That's what I did in post #8. Create directory in pool, use that as the mount point, and when you confirm it works, add that to the server fstab (vi /etc/fstab).

Then for the jail, just create a mount point to that directory like normal.
That's what I did in post #8. Create directory in pool, use that as the mount point, and when you confirm it works, add that to the server fstab (vi /etc/fstab).

Then for the jail, just create a mount point to that directory like normal.

Didn't see this right away.... Yes, that works... mount it in the root freenas, and map it into the jail... Thanks so much.
 

BigPapaPSP

Dabbler
Joined
Jan 24, 2019
Messages
20
Thanks again for all the help...

I have ONE remaining issue here... Evidently when I created the jail I should have selected to allow raw.sockets so that the jail has internet access. As plex uses the internet to download metadata, I need to have the jail changed. I would prefer to make the change to the jail instead of uninstalling and starting over.

Can you give me an idea of what needs to be done to change that jail environment to allow raw sockets? i have nameservers and default gateways set... but evidently this needs to happen also.

Thanks in advance.

D
 

Ixian

Patron
Joined
May 11, 2015
Messages
218
You can do it easily in the GUI. Stop the jail, edit the jail, click Jail Properties drop down at bottom to expand it, check the allow_raw_sockets box, save, start jail.
 

BigPapaPSP

Dabbler
Joined
Jan 24, 2019
Messages
20
You can do it easily in the GUI. Stop the jail, edit the jail, click Jail Properties drop down at bottom to expand it, check the allow_raw_sockets box, save, start jail.

You know -- I looked several times yesterday and never saw the edit option for the jail... I was looking for just that.

But as what seems to be typical for me.... One solution opens another problem... I edited the jail, checked "Vnet" option, and then checked the "Allow raw sockets" -- saved. restarted plugin/jail... Plex not coming up at all.. says offline. I enter the jail shell, and ping... and it no longer gives me an operation forbidden error, but now says destination unreachable... Which I would expect if gateway and nameserver not met. My gateway is set at 10.10.0.1/24.. and dns is set on the server level -- didn't see anything in the jail settings for dns.

What did I miss? I obviously made progress, but why destination unreachable?
The gateway entry in the jail was 10.10.0.1 -- should it have been 10.10.0.1/24 ?? netmask/cidr has been a separate field so I didn't ad it to the end of the ip address. I just added the /24 and didnt' make a difference... i'm trying to ping outside the jail to a local ip -- so this isn't a name server issue as I'm doing direct to ip... but I missed something!!! ideas? SORRY!
D
 
Last edited:

BigPapaPSP

Dabbler
Joined
Jan 24, 2019
Messages
20
You can do it easily in the GUI. Stop the jail, edit the jail, click Jail Properties drop down at bottom to expand it, check the allow_raw_sockets box, save, start jail.

Okay, still having a couple issues but made more progress (see previous replies)

If I change it to DHCP, then it works with the allow raw sockets, and everything is fine. HOWEVER, prefer to have a static IP, but when I remove the DHCP option, and enter the IP address and gateway it stops working... WHAT THE HECK!

Also, oddly -- both servers (nas01 and nas02) both with plex loaded... are both pulling 10.10.0.196 from DHCP, and then they bounce on and offline -- assuming due to ip conflict... I think my DHCP service on my route is looking at the mac address of my computer and giving it the same address... but not sure how to fix... can I edit the mac address for the jail?
 

BigPapaPSP

Dabbler
Joined
Jan 24, 2019
Messages
20
Okay, still having a couple issues but made more progress (see previous replies)

If I change it to DHCP, then it works with the allow raw sockets, and everything is fine. HOWEVER, prefer to have a static IP, but when I remove the DHCP option, and enter the IP address and gateway it stops working... WHAT THE HECK!

Also, oddly -- both servers (nas01 and nas02) both with plex loaded... are both pulling 10.10.0.196 from DHCP, and then they bounce on and offline -- assuming due to IP conflict... I think my DHCP service on my route is looking at the mac address of my computer and giving it the same address... but not sure how to fix... can I edit the mac address for the jail?

Okay found the mac address for the jail on vnet0, and changed it slightly at the right side... now pulls a different ip address. So now this is functional running on DHCP for jail... but still prefer static IP's for my jail...

So that's my only issue at this point... what am I missing for my ip/netmark/gateway settings that's wrong?
 

Ixian

Patron
Joined
May 11, 2015
Messages
218
Did you configure your general network settings (Network>Global Configuration). Insure you have the correct gateway and DNS specified there. Usually they are both your router but depends on how you have that set up.

Do you have an interface set up under Network>Interfaces? You should have at least one, for the NIC you are using. If you don't, add it.

For the Jail configuration, make sure you are using the correct IPv4 interface, the one you checked in the step above. VNET0 (which is the general virtual network stack for Jails) should be bound to it, or a bridge. I doubt you have a bridge but if you do you'd know it.

As for the DHCP assignment issue, it sounds like your router is handing out addresses based on MAC. Normally that is something you'd configure though I suppose your router might have the old MAC cached. Hard for me to say with the detail provided.
 

BigPapaPSP

Dabbler
Joined
Jan 24, 2019
Messages
20
Did you configure your general network settings (Network>Global Configuration). Insure you have the correct gateway and DNS specified there. Usually they are both your router but depends on how you have that set up.

Do you have an interface set up under Network>Interfaces? You should have at least one, for the NIC you are using. If you don't, add it.

For the Jail configuration, make sure you are using the correct IPv4 interface, the one you checked in the step above. VNET0 (which is the general virtual network stack for Jails) should be bound to it, or a bridge. I doubt you have a bridge but if you do you'd know it.

As for the DHCP assignment issue, it sounds like your router is handing out addresses based on MAC. Normally that is something you'd configure though I suppose your router might have the old MAC cached. Hard for me to say with the detail provided.


Yes, Global Network is configured with Gateway and DNS

1548527171623.png


Yes, Network Interface is set


1548527220442.png


Jail configuration works with DHCP checked. If I uncheck it, and enter the ip, gateway, interfaace, etc like the image here... it fails...

WORKS WITH DHCP, DOESN"T WORK WHEN I UNCHECK

1548527423553.png
 

BigPapaPSP

Dabbler
Joined
Jan 24, 2019
Messages
20
ALL WORKING NOW -- THANKS FOR THE HELP..Turned out I needed to clear out hte IP6 stuff... didn't like something i hzad there....

MUCH THANKS
 
Top