Remote NFS Mounts in Jails

*Quick note: the text inside <> is console derived, either output or commands

Scenario: Two TrueNAS hosts; inside of a jail, hosted on Server1, mount an NFS share residing on Server2.
– Server2 exports </mnt/dozer/test> as an NFS share
– Created mount point in jail <mkdir -p /mnt/nfs>
– Tried <mount -t nfs Server2:/mnt/dozer/test /mnt/nfs> in jail

I’ve tried for quite some time now to accomplish this but to no avail… UNTIL TODAY! I sat down, thought about it good and hard and then had a crazy idea; What if I mounted that NFS share from Server2 on Server1 (proper) first then created a mount point in the jail configuration for that path?

On Server1 (proper): <mkdir -p /mnt/nfstest> then
<mount -t nfs Server2:/mnt/dozer/test /mnt/nfstest>
In jail on Server1:
<mkdir -p /mnt/nfstest> then
<mount -t nfs Server1:/mnt/nfstest /mnt/nfs>

But that didn’t frickin’ work so I thought about it some more, for about 5 seconds, then I began Google Fu’ing. With new key words in mind from the crazy idea experiment I was able to find at least a dozen posts/articles outlining the solution I’ve been searching for!

Now, this is NOT supported by iX or the TrueNAS project BUT it’s totally doable and it works exactly as it should. I had the first part right, SSH to Server1 then using the console, mount the NFS share from Server2. Here are the missing pieces;

  1. When mounting the share on Server1, do it inside of an existing dataset instead of creating a new mount path (/mnt/dozer/nfstest vs /mnt/nfstest).
  2. An NFS share on Server1 has to be created via the webUI, using the new console-mounted directory from above.

Finally, via the webUI on Server1, create a new mount point in the jail configuration using mount path from missing piece #1 as the source and wherever you want the destination to be inside the jail ( I used </mnt/test> ).

  • Using console on Server1: <mkdir -p /mnt/dozer/nfstest> then
    <mount -t nfs Server2:/mnt/dozer/test>
  • Using webUI on Server1: Create an NFS share using the path </mnt/dozer/nfstest>
  • Inside jail on Server1 using console: <mkdir -p /mnt/nfs> then
    <mount -t nfs Server1:/mnt/dozer/nfstest /mnt/nfs>

And there you have it… remote NFS mounted storage inside of a jail. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

WordPress Appliance - Powered by TurnKey Linux