Legacy ZFS Sharing Syntax

Oracle Solaris 11 syntax is still supported so that you can share file systems in two steps. This syntax is supported in all pool versions.

  • First, use the zfs set share command to create an NFS or SMB share of ZFS file system.

    $ zfs create rpool/fs1
    $ zfs set share=name=fs1,path=/rpool/fs1,prot=nfs rpool/fs1
    name=fs1,path=/rpool/fs1,prot=nfs
  • Then, set the sharenfs or sharesmb property to on to publish the share. For example:

    $ zfs set sharenfs=on rpool/fs1
    $ grep fs1 /etc/dfs/sharetab
    /rpool/fs1      fs1     nfs     sec=sys,rw

File system shares can be displayed with the legacy zfs get share command.

$ zfs get share rpool/fs1
NAME       PROPERTY  VALUE  SOURCE
rpool/fs1  share     name=fs1,path=/rpool/fs1,prot=nfs  local

In addition, the share command to share a file system, similar to the syntax in the Oracle Solaris 10 release, is still supported to share any directory within a file system. For example, to share a ZFS file system:

$ share -F nfs /tank/zfsfs
$ grep zfsfs /etc/dfs/sharetab
/tank/zfsfs    tank_zfsfs     nfs     sec=sys,rw

The above syntax is identical to sharing a UFS file system:

$ share -F nfs /ufsfs
$ grep ufsfs /etc/dfs/sharetab
/ufsfs          -               nfs     rw
/tank/zfsfs     tank_zfsfs      nfs     rw