To mount or share directories that originate in labeled zones, set the appropriate ZFS share properties on the file system. Then, restart the zone to share the labeled directories.
Before You Begin
You must be assigned the ZFS File System Management rights profile.
# zfs create rpool/wdocs1
For example, the following set of commands shares a documentation file system for writers. The file system is shared read-write so that writers can modify their documents on this server. setuid programs are disallowed.
# zfs set share=name=wdocs1,path=/wdocs1,prot=nfs,setuid=off, exec=off,devices=off rpool/wdocs1 # zfs set sharenfs=on rpool/wdocs1
The command line is wrapped for display purposes.
In the global zone, run one of the following commands for each zone. Each zone can share its file systems in any of these ways. The actual sharing occurs when each zone is brought into the ready or running state.
# zoneadm -z zone-name ready
# zoneadm -z zone-name boot
# zoneadm -z zone-name reboot
In the root role in the global zone, run the following command:
# zfs get all rpool
For more information, see Querying ZFS File System Information in Managing ZFS File Systems in Oracle Solaris 11.4.
For applications that run at the label PUBLIC, the system administrator enables users to read the documentation in the /export/reference file system of the public zone.
First, the administrator changes the workspace label to public workspace and opens a terminal window. In the window, the administrator sets selected share properties on the /reference file system. The following command is wrapped for display purposes.
# zfs set share=name=reference,path=/reference,prot=nfs, setuid=off,exec=off,devices=off,rdonly=on rpool/wdocs1
Then, the administrator shares the file system.
# zfs set sharenfs=on rpool/reference
The administrator leaves the public workspace and returns to the Trusted Path workspace. Because users are not allowed to log in to this file server, the administrator shares the file system by putting the zone in the ready state:
# zoneadm -z public ready
Users can access the shared file system once it is mounted on the users' systems.