ZFS is the default file system when it comes to Solaris 11. In solaris 11, Oracle made it even easy to share ZFS as NFS file system. The major change that oracle made in NFS sharing is that it removed the dependency of /etc/dfs/dfstab to share NFS permanently. The file /etc/dfs/dfstab is obsolete in Solaris 11, so even if you make any changes to it, they are ignored.
Solaris 11 makes use of SMF services to share the NFS file systems automatically while booting. In solaris 11 the ZFS file system is shared as NFS in 2 steps :
Name the share, by assigning a value to datasets name property :
# zfs set share=name=fs1,path=/fs1,prot=nfs geekpool/fs1
Publish the share by setting the sharenfs property to “on”
# zfs set sharenfs=on geekpool/fs1
There is no need to edit any file to make the share permanent. By default when you turn on the sharenfs property to on, it gets permanently shared. SMF services takes care of sharing the NFS file system while booting.
The legacy ZFS sharing Syntax (Solaris 10 Way)
The legacy way of sharing the ZFS file system as NFS (using share command) from solaris 10 is still supported without having to use /etc/dfs/dfstab. Instead we use the file /etc/dfs/sharetab in Solaris 11.
# share -F nfs /fs1 # cat /etc/dfs/sharetab /fs1 - nfs rw
Display the shares
To display the information on shared NFS file systems you can use below 2 commands :
# zfs get sharenfs geekpool/fs1 NAME PROPERTY VALUE SOURCE geekpool/fs1 sharenfs on local
# zfs get share geekpool/fs1 NAME PROPERTY VALUE SOURCE geekpool/fs1 share name=geekpool_fs1,path=/fs1,prot=nfs local
Inheritance of share
When you share a ZFS file systems as NFS, all its children inherit the sharenfs property. For example if we share geekpool/fs1 :
# zfs set share=name=fs1,path=/fs1,prot=nfs geekpool/fs1 name=fs1,path=/fs1,prot=nfs # zfs set sharenfs=on geekpool/fs1
If you check the share sharenfs property of geekpool/fs1/fs2 which is a child dataset of fs1 :
# zfs get sharenfs geekpool/fs1/fs2 NAME PROPERTY VALUE SOURCE geekpool/fs1/fs2 sharenfs on inherited from geekpool/fs1
Unsharing the share
To unshare the shared file system using the share-path property :
# zfs set -c share=path=/fs1 geekpool/data share 'geekpool_fs1' was removed.
To unshare the file system using share-name property :
# zfs set -c share=name=geekpool_fs1 geekpool/fs1 share 'geekpool_fs1' was removed.