Skip to main content
Solaris 11 OCA

Configuring NFS Exports using ZFS Data Sets

By December 27, 2013September 12th, 2022No Comments

In the general theme of Oracle Solaris 11 as admins we should find that command line tools should stream line the process of tasks and alleviate the need of additional edits to configuration files. In this tutorial we look at how we can configure NFS shares from the command line with the ZFS command and ensure the services are started to support the shares.

Listing services

Using the command svcs(/usr/sbin/svcs) we can display information about service instances from the services repository. To display all services including those that are disables we can use the –a option.

svcs –a | grep nfs

Here we are searching for nfs in the service instance name. The only service running that matches that name is the fedfs client; we can see from the output that the NFS server is not running and is disabled.

Listing Shares

If the NFS server is not running then, or course, there will be no shares. We can verify this and later we will be able to use the same command to show the ZFS shares have been exported.

showmount  –e localhost

Any shares would e listed in the file /etc/sfs/sharetab

Creating simple NFS shares with ZFS data sets

If we just need an NFS share and it is acceptable to be read-writable by all hosts that cn connect we can use the option sharenfs=on.

zfs create –o mountpoint=/share –o sharenfs=on rpool/share

With the data set created and nothing more than this in place; when we recheck the services, shares and sharetab file now indicate that NFS is fully functional.

First let’s recheck the svcs command

svcs –a | grep nfs

The NFS server and associated services are now configured and running and if we further check the showmount command and the sharetab file; these too show that the directory /share is now an NFS export or share and set to rw.


Disabling shares

If the NFS share needs to be disabled whilst the data set is still operational properties can be reversed or changed

zfs set sharenfs=off rpool/share


Other options

If more control over the NFS exports is required this can be set with ZFS. These are set using the share option and a comma list of share options

zfs set share=name=share,path=/share,prot=nfs,ro=@192.168.1, 
 rw=  rpool/share
  • set share=name=<sharename> start the properties list with the share name
  • path=/share
  • ro=@192.168.1 The at symbol indicates that this is a partial network address and includes all host on the 192.168.1 network in this case
  • rw= As we have multiple entries in the rw list the list is delimited by the colon. The @ symbol is not needed as a complete IP address is used.

Setting the share properties does not re-enable the share; this has to be set with

set sharenfs=on rpool/share