JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris Administration: ZFS File Systems     Oracle Solaris 11 Information Library
search filter icon
search icon

Document Information

Preface

1.  Oracle Solaris ZFS File System (Introduction)

2.  Getting Started With Oracle Solaris ZFS

3.  Oracle Solaris ZFS and Traditional File System Differences

4.  Managing Oracle Solaris ZFS Storage Pools

5.  Managing ZFS Root Pool Components

6.  Managing Oracle Solaris ZFS File Systems

Managing ZFS File Systems (Overview)

Creating, Destroying, and Renaming ZFS File Systems

Creating a ZFS File System

Destroying a ZFS File System

Renaming a ZFS File System

Introducing ZFS Properties

ZFS Read-Only Native Properties

The used Property

Settable ZFS Native Properties

The canmount Property

The casesensitivity Property

The copies Property

The dedup Property

The encryption Property

The recordsize Property

The sharesmb Property

The volsize Property

ZFS User Properties

Querying ZFS File System Information

Listing Basic ZFS Information

Creating Complex ZFS Queries

Managing ZFS Properties

Setting ZFS Properties

Inheriting ZFS Properties

Querying ZFS Properties

Querying ZFS Properties for Scripting

Mounting ZFS File Systems

Managing ZFS Mount Points

Automatic Mount Points

Legacy Mount Points

Mounting ZFS File Systems

Using Temporary Mount Properties

Unmounting ZFS File Systems

Sharing and Unsharing ZFS File Systems

Legacy ZFS Sharing Syntax

New ZFS Sharing Syntax

Displaying ZFS Share Information

ZFS Sharing Inheritance

Changing a ZFS Share

Removing a ZFS Share

ZFS File Sharing Within a Non-Global Zone

New ZFS Sharing and Legacy Share Command Summary

Troubleshooting ZFS Share Problems

ZFS Sharing Migration/Transition Issues

Setting ZFS Quotas and Reservations

Setting Quotas on ZFS File Systems

Setting User and Group Quotas on a ZFS File System

Setting Reservations on ZFS File Systems

Encrypting ZFS File Systems

Changing an Encrypted ZFS File System's Keys

Delegating ZFS Key Operation Permissions

Mounting an Encrypted ZFS File System

Interactions Between ZFS Compression, Deduplication, and Encryption Properties

Examples of Encrypting ZFS File Systems

Migrating ZFS File Systems

How to Migrate a File System to a ZFS File System

Troubleshooting ZFS File System Migrations

Upgrading ZFS File Systems

7.  Working With Oracle Solaris ZFS Snapshots and Clones

8.  Using ACLs and Attributes to Protect Oracle Solaris ZFS Files

9.  Oracle Solaris ZFS Delegated Administration

10.  Oracle Solaris ZFS Advanced Topics

11.  Oracle Solaris ZFS Troubleshooting and Pool Recovery

12.  Archiving Snapshots and Root Pool Recovery

13.  Recommended Oracle Solaris ZFS Practices

A.  Oracle Solaris ZFS Version Descriptions

Index

Sharing and Unsharing ZFS File Systems

In this Solaris release, you create a ZFS file system share and publish the share as follows:

Using a separate command to create a share provides the following features:

The interaction between the defined shares and the sharenfs and sharesmb properties is as follows:

This section details some of the differences between the new sharing syntax and legacy sharing syntax.

The primary new sharing differences are as follows:

Legacy ZFS Sharing Syntax

Legacy sharing syntax is still supported.

  1. Use the share command to share a file system.

    For example, to share a ZFS file system:

    # share -F nfs /tank/zfsfs
    # cat /etc/dfs/sharetab
    /tank/zfsfs        -       nfs     rw

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

    # share -F nfs /ufsfs
    # cat /etc/dfs/sharetab
    /ufsfs  -       nfs     rw      
    /tank/zfsfs     -       nfs     rw      
  2. The zfs share command cannot be used to initially share a file system until the sharenfs property is set.

    # zfs share rpool/data
    cannot share 'rpool/data': legacy share
    use share(1M) to share this filesystem, or
    set the 'share' property and set [sharenfs|sharesmb] property on
    # zfs set sharenfs=on rpool/data
    # cat /etc/dfs/sharetab
    /rpool/data     -       nfs     rw     

All methods publish the file system shares immediately.

New ZFS Sharing Syntax

The new zfs set share command is used to share a ZFS file system over the NFS or SMB protocols. The share is not published until the sharenfs set property is also set on the file system.

Use the zfs set share command to create an NFS or SMB share of ZFS file system and also set the sharenfs property.

# zfs create rpool/fs1
# zfs set share=name=fs1,path=/rpool/fs1,prot=nfs rpool/fs1
name=fs1,path=/rpool/fs1,prot=nfs

The share is not published until the sharenfs or sharesmb property is set to on. For example:

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

A public NFS share can be created as follows:

# zfs set share=name=pp,path=/pub,prot=nfs,sec=sys,rw=*,public rpool/public
name=pp,path=/pub,prot=nfs,public=true,sec=sys,rw=*
# zfs set sharenfs=on rpool/public
# cat /etc/dfs/sharetab
/pub    pp      nfs     public,sec=sys,rw 

You can also create a share of a newly created ZFS file system by using syntax similar to the following:

# zfs create -o mountpoint=/ds -o sharenfs=on rpool/ds

When you create a NFS share of a ZFS file system, you must provide the following share components:

share=name

Identify a name for your share. Maximum share name is 80 characters.

path=pathname

Identify a path for your NFS share that must exist within the file system or directory to be shared.

prot=nfs or smb

Identify the protocol as NFS or SMB.

pool/filesystem

Identifies the ZFS file system to be shared.

Additional share options are:

description=string

Provides text that might help identify the share. Spaces or commas in the description must be enclosed in quote marks (" ").

rw= or ro=

Identifies whether the share is available as read/write or read-only to all clients. You can also specify a colon-separated list that includes hostnames, IP addresses, or a netgroup.

root=

Identifies a root user from a specified host or list of hosts have root access. By default, no host has root access.

sec=

Identifies a NFS server security mode, such as sys, dh, krb5, and so on. For supported security mode information, see nfssec(5).

The following NFS properties must be specified after prot=nfs, but before any sec= properties.

The following optional SMB properties must be specified after the prot=smb property:

See share_nfs(1M) and share_smb(1M) for a detailed description of NFS and SMB share properties.

Displaying ZFS Share Information

As in the previous releases, you display the value of the sharenfs property by using zfs get sharenfs property or by using the zfs get all command syntax.

# zfs get sharenfs rpool/fs1
NAME       PROPERTY  VALUE     SOURCE
rpool/fs1  sharenfs  on        local

The new share information is available by using the zfs get share command.

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

The new share information is not available in the zfs get all command syntax.

If you create a share of a newly created ZFS file system, use the zfs get share command to identify the share-name name or the share-path name. For example:

# zfs create -o mountpoint=/data -o sharenfs=on rpool/data
# zfs get share rpool/data
NAME                                     PROPERTY  VALUE  SOURCE
rpool/data                               share     name=data,path=/data,prot=nfs  local

ZFS Sharing Inheritance

Inheritance of the zfs share property and the sharenfs or the sharesmb property works as follows:

Changing a ZFS Share

The name and protocol properties must be specified when you change share property values.

For example, create an NFS share like this:

# zfs create -o mountpoint=/ds -o sharenfs=on rpool/ds
# zfs set share=name=ds,path=/ds,prot=nfs rpool/ds
name=ds,path=/ds,prot=nfs

Then, add the SMB protocol:

# zfs set share=name=ds,prot=nfs,prot=smb rpool/ds
name=ds,path=/ds,prot=nfs,prot=smb

Remove the SMB protocol:

# zfs set -c share=name=ds,prot=smb rpool/ds
name=ds,path=/ds,prot=nfs

Removing a ZFS Share

You can remove an existing share by using the zfs set -c command. For example, identify the share name.

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

Then, remove the share by identifying the share-name name. For example:

# zfs set -c share=name=ds rpool/ds
share 'ds' was removed.

If a share is established by creating a default share, when the file system is created, then a share can be removed by the share-name name or the share-path name. For example, this share is given a default share-name name, data, and a default share-path name, /data.

# zfs create -o mountpoint=/data -o sharenfs=on rpool/data
# zfs get share rpool/data
NAME         PROPERTY  VALUE  SOURCE
rpool/data  share     name=data,path=/data,prot=nfs  local

Remove the share by identifying the share-name name. For example:

# zfs set -c share=name=data rpool/data
share 'data' was removed.

Remove the share by identifying the share-path name. For example:

# zfs set -c share=path=/data rpool/data
share 'data' was removed.

ZFS File Sharing Within a Non-Global Zone

In previous Solaris releases, you could not create and publish NFS or SMB shares in a Oracle Solaris non-global zone. In this Solaris release, you can create and publish NFS shares by using the zfs set share command and the legacy share command with a non-global zone.

For example, the /export/home/data and /export/home/data1 file systems are available in the zfszone.

zfszone# share -F nfs /export/home/data
zfszone#  cat /etc/dfs/sharetab
/export/home/data     export_home_data      nfs     sec=sys,rw
zfszone# zfs set share=name=data1,path=/export/home/data1,prot=nfs 
tank/zones/export/home/data1
zfszone# zfs set sharenfs=on tank/zones/export/home/data1
zfszone# cat /etc/dfs/sharetab
/export/home/data1      data1   nfs     sec=sys,rw 

New ZFS Sharing and Legacy Share Command Summary

This table describes the new ZFS file system sharing syntax and the legacy sharing syntax.

Table 6-5 ZFS Sharing and Legacy Share Command Summary

ZFS Share Task
Legacy Share Syntax
New Share Syntax
Share a ZFS file system over NFS.
Set the sharenfs property to on.
# zfs set sharenfs=on tank/fs1
  1. Create the NFS share.
    # zfs set share=name=fs1,path=/fs1,
    prot=nfs tank/fs1
  2. Set the sharenfs property to on.

    # zfs set sharenfs=on tank/fs1
Share ZFS file system over SMB.
Set the sharesmb property to on.
# zfs set sharesmb=on tank/fs2
  1. Create the SMB share.
    # zfs set share=name=fs2,path=/fs2,
    prot=smb tank/fs2
  2. Set the sharesmb property to on.

    # zfs set sharesmb=on tank/fs2
Unshare the ZFS file system.
Set the sharenfs property to off.
# zfs set sharenfs=off tank/fs1
Set the sharenfs property to off.
# zfs set sharenfs=off tank/fs1
Set the sharesmb property to off.
# zfs set sharesmb=off tank/fs2
Set the sharesmb property to off.
# zfs set sharesmb=off tank/fs2
Add share options to an existing share.
Reset the sharenfs property.
# zfs set sharenfs=nosuid tank/fs1
Reset the share with the additional property.
# zfs set share=name=fs1,prot=nfs,
nosuid rpool/fs1
name=fs1,path=/rpool/fs1,prot=nfs,
nosuid=true
Create a permanent NFS share.
Set the sharenfs property to on.
# zfs set sharenfs=on tank/fs1

For legacy share command syntax, you had to edit the /etc/dfs/dfstab file to create a permanent share.

Set the sharenfs property to on.
# zfs set sharenfs=on tank/fs1

The /etc/dfs/dfstab file is not available in this Solaris release.

Create a permanent SMB share.
Set the sharesmb property to on.
# zfs set sharesmb=on tank/fs2

Or, create the SMB share with sharemgr.

# sharemgr create -P smb fssmb
# sharemgr add-share -r fs-smb -s /tank/fs2 fssmb
Set the sharesmb property to on.
# zfs set sharesmb=on tank/fs2

The sharemgr feature is not available in this Solaris release.

Troubleshooting ZFS Share Problems

ZFS Sharing Migration/Transition Issues

Identify any transition issues in this section.