Mounting Remote NFS within a jail

Status
Not open for further replies.

clownphish

Dabbler
Joined
Dec 9, 2012
Messages
33
I currently have my jail running reasonably well (and I've been super-impressed how easy and full of features it is - well done!). I am struggling with an issue though; I want to mount a remote NFS share (i.e. one served by another device on my network, not my FreeNAS device) on the jail startup. I get an 'operation not permitted' error if I attempt to do this from within the jail. From reading documentation, I see that the recommended way to do this is to mount it from the host system, which is what I'm now attempting.

I have mounts from my FreeNAS system (using NULLFS) working on startup through the GUI but it doesn't accept NFS syntax (by design, presumably, as there is no 'FS type' option). I've also found the /etc/fstab.<jailname> file which I thought I could add my NFS mount to. Sadly, this file appears to be created at startup and disappears when the jail is stopped.

Mounting the NFS share manually from the host FreeNAS works fine (and the jail can access it)

Does anyone have a solution or workaround (some post-startup script perhaps) that would mount this at startup? I guess one long-term option would be a feature request to support NFS mounts for jails through the GUI but I'd like something more immediate :)

I'm running FreeNAS-8.3.0-RELEASE-x64 (r12701M).
 

paleoN

Wizard
Joined
Apr 22, 2012
Messages
1,403
Does anyone have a solution or workaround (some post-startup script perhaps) that would mount this at startup? I guess one long-term option would be a feature request to support NFS mounts for jails through the GUI but I'd like something more immediate :)
There's this thread by Milhouse, [thread=9456]Put Jail /tmp and /var/tmp in memory?[/thread], which modifies the jail startup. Submit the feature request as well.
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
I have mounts from my FreeNAS system (using NULLFS) working on startup through the GUI but it doesn't accept NFS syntax (by design, presumably, as there is no 'FS type' option). I've also found the /etc/fstab.<jailname> file which I thought I could add my NFS mount to. Sadly, this file appears to be created at startup and disappears when the jail is stopped.

Using NULLFS isn't the correct way to mount NFS to the jail. You need to think of the jail as it's own operatiing system and mount it the way you normally would in a FreeBSD system (/etc/fstab).

It's been awhile since I've tried this, but I had no problem mounting NFS shares from inside the jail and it was a great alternative to using mountpoints from the FreeNAS host.
 

clownphish

Dabbler
Joined
Dec 9, 2012
Messages
33
Using NULLFS isn't the correct way to mount NFS to the jail. You need to think of the jail as it's own operatiing system and mount it the way you normally would in a FreeBSD system (/etc/fstab).

Thanks for the reply. Apologies if I didn't explain this well. I meant that I'm happily using the GUI functionality to mount existing pools on my FreeNAS. I discovered that this was nullfs by running cat on /etc/fstab.software

It's been awhile since I've tried this, but I had no problem mounting NFS shares from inside the jail and it was a great alternative to using mountpoints from the FreeNAS host.

I'd love this to work! Perhaps I'm doing something wrong? These are my steps:
1) Login to my jail (called 'software') as root
2) Attempt to mount my NFS share:
Code:
software# mount -t nfs -o rw <mynasIPaddress>:/DataVolume/Public/Shared\ Music /media/mybook/Shared\ Music/
mount_nfs: /media/mybook/Shared Music, : Operation not permitted


The same command (with a modified destination path to make it mount to the jail) when run from outside the jail works fine :
Code:
[root@axiom] ~# mount -t nfs -o rw <mynasIPaddress>:/DataVolume/Public/Shared\ Music /mnt/system/jail/software/media/mybook/Shared\ Music/


I've tried adding the correct line to the /etc/fstab within the jail just in case but I get the same error message when I run 'mount -a' (mount_nfs: /media/mybook, : Operation not permitted)

Is there something I need to do to allow the operation within the jail?
 

clownphish

Dabbler
Joined
Dec 9, 2012
Messages
33
Thanks for that. Any ideas on a workaround in the meantime on how to automagically add a mount point from outside of the jail (in a similar manner to the way nullfs happens right now)? e.g. on jail startup
 
Status
Not open for further replies.
Top