# Possible to NFSv4 share all ZFS filesystems?



## littlesandra88 (Feb 23, 2013)

Hello =)

I would like to NFSv4 share all ZFS filesystems in my tank3 pool to a Linux host.

The problem is that I am only allowed to have one mount point on the Linux host.

I don't suppose it is possible to NFSv4 share the zpool it self?

Or should I put all zfs file systems in a root zfs filesystem /tank3/root/, then share that one? E.g.


```
/tank3/root/project1
/tank3/root/project2
```

What is the recommended solution for such a problem?


----------



## cpm@ (Feb 23, 2013)

You can also share all ZFS file systems on the system by using the *-a* option, thereby: 
`# zfs share -a`

To share a file system, use zfs set syntax:
`# zfs set sharenfs=on tank3/root/project1`
`# zfs set sharenfs=on tank3/root/project2`

Reading recommended: Mounting and Sharing ZFS File Systems.


----------



## littlesandra88 (Feb 23, 2013)

So what would the mount point on the Linux host become?


----------



## cpm@ (Feb 23, 2013)

Take a look http://lists.freebsd.org/pipermail/freebsd-fs/2009-November/007121.html.


----------



## cpm@ (Feb 23, 2013)

littlesandra88 said:
			
		

> So what would the mount point on the Linux host become?



Using mount command, syntax should be (assuming "V4: /" was used):
`# mount -t nfs4 <server>:/export /mnt`


----------



## junovitch@ (Feb 24, 2013)

On FreeBSD:

```
echo 'V4: / -sec=sys' >> /etc/exports
zfs set sharenfs='on' tank3/root
```

On Linux:
Note that if you just mount /tank3/root you will see folders but if you try to create anything in them it will not propagated to the ZFS dataset.  You have to mount each ZFS dataset one by one.

```
mount -t nfs4 <server>:/tank3/root/project1
mount -t nfs4 <server>:/tank3/root/project2
```

Or, since the manually mounting above can get painful as you add additional folders, you can use autofs on Linux to automatically mount the ZFS datasets.  This is Ubuntu/Mint compatible, taylor it as needed.  Make sure your hostnames are FQDN on both sides as well.

```
apt-get install autofs nfs-common
echo "NEED_IDMAPD=yes" >> /etc/default/nfs-common
echo -e "/tank3/root\t/etc/auto.tank3" >> /etc/auto.master
echo -e "*\t-fstype=nfs4\t<server>:/tank3/root/&" >> /etc/auto.tank3
```

*EDIT*
I read a little close and can you clarify "The problem is that I am only allowed to have one mount point on the Linux host"?  What I said above applies, each ZFS dataset must be mounted individually be it manually or through something like autofs.  If you mount the root of a bunch of datasets you will seem them as folders but you can't do anything.


----------

