|
Key
This line was removed.
This word was removed. This word was added.
This line was added.
|
Changes (2)
View page history| <html> <head> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Managing ZFS File Systems - Solaris ZFS Administration Guide</title> <meta content="index,follow" name="robots"> <meta name="date" content="Jun 19, 2009"> <meta content="reference" name="collection"> <link href="css/elements.css" type="text/css" rel="stylesheet"> <link href="css/indiana.css" type="text/css" rel="stylesheet"> </head> <body> <div class="Masthead"> <div class="MastheadLogo"></div> <div class="Title">Solaris ZFS Administration Guide</div> </div> <table width="100%" cellspacing="0" border="0" class="Layout"> <tbody> <tr class="PageControls" valign="top"> <td></td><td> <table width="100%"> <tr> <td align="left"><a href="chapter4.html">Previous</a></td><td align="right"><a href="chapter6.html">Next</a></td> </tr> </table> </td> </tr> <tr valign="top"> <td width="200px" class="Navigation"> <p class="toc level1 tocsp"> <a href="bookinfo.html">Document Information</a> </p> <p class="toc level1 tocsp"> <a href="preface.html">Preface</a> </p> <p class="toc level1 tocsp"> <a href="chapter.html">1. Solaris ZFS File System (Introduction)</a> </p> <p class="toc level1 tocsp"> <a href="chapter2.html">2. Getting Started With ZFS</a> </p> <p class="toc level1 tocsp"> <a href="chapter3.html">3. ZFS and Traditional File System Differences</a> </p> <p class="toc level1 tocsp"> <a href="chapter4.html">4. Managing ZFS Storage Pools</a> </p> <div class="onpage"> <p class="toc level1 tocsp"> <a href="chapter5.html">5. Managing ZFS File Systems</a> </p> <p class="toc level2"> <a href="#gamnq">Creating and Destroying ZFS File Systems</a> </p> <p class="toc level2"> <a href="#gazss">Introducing ZFS Properties</a> </p> <p class="toc level2"> <a href="#gazsu">Querying ZFS File System Information</a> </p> <p class="toc level2"> <a href="#gayns">Managing ZFS Properties</a> </p> <p class="toc level2"> <a href="#gaynd">Mounting and Sharing ZFS File Systems</a> </p> <p class="toc level2"> <a href="#gazvb">ZFS Quotas and Reservations</a> </p> </div> <p class="toc level1 tocsp"> <a href="chapter6.html">6. Working With ZFS Snapshots and Clones</a> </p> <p class="toc level1 tocsp"> <a href="chapter7.html">7. Using ACLs to Protect ZFS Files</a> </p> <p class="toc level1 tocsp"> <a href="chapter8.html">8. ZFS Delegated Administration</a> </p> <p class="toc level1 tocsp"> <a href="chapter9.html">9. ZFS Advanced Topics</a> </p> <p class="toc level1 tocsp"> <a href="chapter10.html">10. ZFS Troubleshooting and Data Recovery</a> </p> </td><td class="ContentPane" width="705px"> <div class="MainContent"> <a name="gavwq"></a>Chapter 5<h3>Managing ZFS File Systems</h3> <p>This chapter provides detailed information about managing Solaris<sup>TM</sup> ZFS file systems. Concepts such as hierarchical file system layout, property inheritance, and automatic mount point management and share interactions are included in this chapter.</p> <p>A ZFS file system is a lightweight POSIX file system that is built on top of a storage pool. File systems can be dynamically created and destroyed without requiring you to allocate or format any underlying space. Because file systems are so lightweight and because they are the central point of administration in ZFS, you are likely to create many of them.</p> <p>ZFS file systems are administered by using the <tt>zfs</tt> command. The <tt>zfs</tt> command provides a set of subcommands that perform specific operations on file systems. This chapter describes these subcommands in detail. Snapshots, volumes, and clones are also managed by using this command, but these features are only covered briefly in this chapter. For detailed information about snapshots and clones, see <a href="chapter6.html#gavvx">Chapter 6, Working With ZFS Snapshots and Clones</a>. For detailed information about emulated volumes, see <a href="chapter9.html#gaypf">ZFS Volumes</a>.</p> <hr> <p> <b>Note - </b> <p>The term <b>dataset</b> is used in this chapter as a generic term to refer to a file system, snapshot, clone, or volume.</p> </p> <hr> <p>The following sections are provided in this chapter:</p> <ul> <li> <p> <a href="chapter5.html#gamnq">Creating and Destroying ZFS File Systems</a> </p> </li> <li> <p> <a href="chapter5.html#gazss">Introducing ZFS Properties</a> </p> </li> <li> <p> <a href="chapter5.html#gazsu">Querying ZFS File System Information</a> </p> </li> <li> <p> <a href="chapter5.html#gayns">Managing ZFS Properties</a> </p> </li> <li> <p> <a href="chapter5.html#gaynd">Mounting and Sharing ZFS File Systems</a> </p> </li> <li> <p> <a href="chapter5.html#gazvb">ZFS Quotas and Reservations</a> </p> </li> <li> <p> <a href="chapter6.html#gbchx">Saving and Restoring ZFS Data</a> </p> </li> </ul> <a name="gamnq"></a> <h3>Creating and Destroying ZFS File Systems</h3> <p>ZFS file systems can be created and destroyed by using the <tt>zfs create</tt> and <tt>zfs destroy</tt> commands.</p> <ul> <li> <p> <a href="chapter5.html#gazsf">Creating a ZFS File System</a> </p> </li> <li> <p> <a href="chapter5.html#gammq">Destroying a ZFS File System</a> </p> </li> <li> <p> <a href="chapter5.html#gamnn">Renaming a ZFS File System</a> </p> </li> </ul> <a name="gazsf"></a> <h3>Creating a ZFS File System</h3> <p>ZFS file systems are created by using the <tt>zfs create</tt> command. The <tt>create</tt> subcommand takes a single argument: the name of the file system to create. The file system name is specified as a path name starting from the name of the pool:</p> <p> <tt><i>pool-name/[filesystem-name/]filesystem-name</i></tt> </p> <p>The pool name and initial file system names in the path identify the location in the hierarchy where the new file system will be created. All the intermediate file system names must already exist in the pool. The last name in the path identifies the name of the file system to be created. The file system name must satisfy the naming conventions defined in <a href="chapter.html#gbcpt">ZFS Component Naming Requirements</a>.</p> <p>In the following example, a file system named <tt>bonwick</tt> is created in the <tt>tank/home</tt> file system.</p> <pre> <tt># <tt>zfs create tank/home/bonwick</tt></tt> </pre> <p>ZFS automatically mounts the newly created file system if it is created successfully. By default, file systems are mounted as <tt><i>/dataset</i></tt>, using the path provided for the file system name in the <tt>create</tt> subcommand. In this example, the newly created <tt>bonwick</tt> file system is at <tt>/tank/home/bonwick</tt>. For more information about automanaged mount points, see <a href="chapter5.html#gaztn">Managing ZFS Mount Points</a>.</p> <p>For more information about the <tt>zfs create</tt> command, see zfs1M.</p> <p>You can set file system properties when the file system is created.</p> <p>In the following example, a mount point of <tt>/export/zfs</tt> is specified and is created for the <tt>tank/home</tt> file system.</p> <pre> <tt># <tt>zfs create -o mountpoint=/export/zfs tank/home</tt></tt> </pre> <p>For more information about file system properties, see <a href="chapter5.html#gazss">Introducing ZFS Properties</a>.</p> <a name="gammq"></a> <h3>Destroying a ZFS File System</h3> <p>To destroy a ZFS file system, use the <tt>zfs destroy</tt> command. The destroyed file system is automatically unmounted and unshared. For more information about automatically managed mounts or automatically managed shares, see <a href="chapter5.html#gbala">Automatic Mount Points</a>.</p> <p>In the following example, the <tt>tabriz</tt> file system is destroyed.</p> <pre> <tt># <tt>zfs destroy tank/home/tabriz</tt></tt> </pre> <hr> <p> <b>Caution - </b> <p>No confirmation prompt appears with the <tt>destroy</tt> subcommand. Use it with extreme caution.</p> </p> <hr> <p>If the file system to be destroyed is busy and so cannot be unmounted, the <tt>zfs destroy</tt> command fails. To destroy an active file system, use the <tt>f</tt> option. Use this option with caution as it can unmount, unshare, and destroy active file systems, causing unexpected application behavior.</p> <pre> <tt># <tt>zfs destroy tank/home/ahrens</tt> cannot unmount 'tank/home/ahrens': Device busy # <tt>zfs destroy -f tank/home/ahrens</tt></tt> </pre> <p>The <tt>zfs destroy</tt> command also fails if a file system has children. To recursively destroy a file system and all its descendents, use the <tt>r</tt> option. Note that a recursive destroy also destroys snapshots so use this option with caution.</p> <pre> <tt># <tt>zfs destroy tank/ws</tt> cannot destroy 'tank/ws': filesystem has children use '-r' to destroy the following datasets: tank/ws/billm tank/ws/bonwick tank/ws/maybee # <tt>zfs destroy -r tank/ws</tt></tt> </pre> <p>If the file system to be destroyed has indirect dependents, even the recursive destroy command described above fails. To force the destruction of <b>all</b> dependents, including cloned file systems outside the target hierarchy, the <tt>R</tt> option must be used. Use extreme caution with this option.</p> <pre> <tt># <tt>zfs destroy -r tank/home/schrock</tt> cannot destroy 'tank/home/schrock': filesystem has dependent clones use '-R' to destroy the following datasets: tank/clones/schrock-clone # <tt>zfs destroy -R tank/home/schrock</tt></tt> </pre> <hr> <p> <b>Caution - </b> <p>No confirmation prompt appears with the <tt>f</tt>, <tt>r</tt>, or <tt>R</tt> options so use these options carefully.</p> </p> <hr> <p>For more information about snapshots and clones, see <a href="chapter6.html#gavvx">Chapter 6, Working With ZFS Snapshots and Clones</a>.</p> <a name="gamnn"></a> <h3>Renaming a ZFS File System</h3> <p>File systems can be renamed by using the <tt>zfs rename</tt> command. Using the <tt>rename</tt> subcommand can perform the following operations:</p> <ul> <li> <p>Change the name of a file system </p> </li> <li> <p>Relocate the file system to a new location within the ZFS hierarchy</p> </li> <li> <p>Change the name of a file system and relocate it with the ZFS hierarchy</p> </li> </ul> <p>The following example uses the <tt>rename</tt> subcommand to do a simple rename of a file system:</p> <pre> <tt># <tt>zfs rename tank/home/kustarz tank/home/kustarz_old</tt></tt> </pre> <p>This example renames the <tt>kustarz</tt> file system to <tt>kustarz_old</tt>. </p> <p>The following example shows how to use <tt>zfs rename</tt> to relocate a file system.</p> <pre> <tt># <tt>zfs rename tank/home/maybee tank/ws/maybee</tt></tt> </pre> <p>In this example, the <tt>maybee</tt> file system is relocated from <tt>tank/home</tt> to <tt>tank/ws</tt>. When you relocate a file system through rename, the new location must be within the same pool and it must have enough space to hold this new file system. If the new location does not have enough space, possibly because it has reached its quota, the rename will fail.</p> <p>For more information about quotas, see <a href="chapter5.html#gazvb">ZFS Quotas and Reservations</a>.</p> <p>The rename operation attempts an unmount/remount sequence for the file system and any descendent file systems. The rename fails if the operation is unable to unmount an active file system. If this problem occurs, you will need to force unmount the file system.</p> <p>For information about renaming snapshots, see <a href="chapter6.html#gbion">Renaming ZFS Snapshots</a>.</p> <a name="gazss"></a> <h3>Introducing ZFS Properties</h3> <p>Properties are the main mechanism that you use to control the behavior of file systems, volumes, snapshots, and clones. Unless stated otherwise, the properties defined in the section apply to all the dataset types.</p> <ul> <li> <p> <a href="chapter5.html#gazsy">ZFS Read-Only Native Properties</a> </p> </li> <li> <p> <a href="chapter5.html#gazsd">Settable ZFS Native Properties</a> </p> </li> <li> <p> <a href="chapter5.html#gdrcw">ZFS User Properties</a> </p> </li> </ul> <p>Properties are divided into two types, native properties and user defined properties. Native properties either export internal statistics or control ZFS file system behavior. In addition, native properties are either settable or read-only. User properties have no effect on ZFS file system behavior, but you can use them to annotate datasets in a way that is meaningful in your environment. For more information on user properties, see <a href="chapter5.html#gdrcw">ZFS User Properties</a>.</p> <p>Most settable properties are also inheritable. An inheritable property is a property that, when set on a parent, is propagated down to all of its descendents.</p> <p>All inheritable properties have an associated source. The source indicates how a property was obtained. The source of a property can have the following values:</p> <dl> <dt> <tt>local</tt> </dt> <dd> <p>A <tt>local</tt> source indicates that the property was explicitly set on the dataset by using the <tt>zfs set</tt> command as described in <a href="chapter5.html#gazsp">Setting ZFS Properties</a>.</p> </dd> <dt> <tt>inherited from</tt> <tt><i>dataset-name</i></tt> </dt> <dd> <p>A value of <tt>inherited from</tt> <tt><i>dataset-name</i></tt> means that the property was inherited from the named ancestor.</p> </dd> <dt> <tt>default</tt> </dt> <dd> <p>A value of <tt>default</tt> means that the property setting was not inherited or set locally. This source is a result of no ancestor having the property as source <tt>local</tt>.</p> </dd> </dl> <p>The following table identifies both read-only and settable native ZFS file system properties. Read-only native properties are identified as such. All other native properties listed in this table are settable. For information about user properties, see <a href="chapter5.html#gdrcw">ZFS User Properties</a>.</p> <a name="gcfgr"></a> <h6>ZFS Native Property Descriptions</h6> <table cellpadding="8" cellspacing="2" border="1"> <tr> <th valign="" align=""> <p>Property Name</p> </th><th valign="" align=""> <p>Type</p> </th><th valign="" align=""> <p>Default Value</p> </th><th valign="" align=""> <p>Description</p> </th> </tr> <tr> <td valign="" align=""> <p> <tt>aclinherit</tt> </p> </td><td valign="" align=""> <p>String</p> </td><td valign="" align=""> <p> <tt>secure</tt> </p> </td><td valign="" align=""> <p>Controls how ACL entries are inherited when files and directories are created. The values are <tt>discard</tt>, <tt>noallow</tt>, <tt>secure</tt>, and <tt>passthrough</tt>. For a description of these values, see <a href="chapter7.html#gbaaz">ACL Property Modes</a>.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>aclmode</tt> </p> </td><td valign="" align=""> <p>String</p> </td><td valign="" align=""> <p> <tt>groupmask</tt> </p> </td><td valign="" align=""> <p>Controls how an ACL entry is modified during a <tt>chmod</tt> operation. The values are <tt>discard</tt>, <tt>groupmask</tt>, and <tt>passthrough</tt>. For a description of these values, see <a href="chapter7.html#gbaaz">ACL Property Modes</a>.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>atime</tt> </p> </td><td valign="" align=""> <p>Boolean</p> </td><td valign="" align=""> <p> <tt>on</tt> </p> </td><td valign="" align=""> <p>Controls whether the access time for files is updated when they are read. Turning this property off avoids producing write traffic when reading files and can result in significant performance gains, though it might confuse mailers and other similar utilities.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>available</tt> </p> </td><td valign="" align=""> <p>Number</p> </td><td valign="" align=""> <p>N/A</p> </td><td valign="" align=""> <p>Read-only property that identifies the amount of space available to the dataset and all its children, assuming no other activity in the pool. Because space is shared within a pool, available space can be limited by various factors including physical pool size, quotas, reservations, or other datasets within the pool.</p> <p>This property can also be referenced by its shortened column name, <tt>avail</tt>.</p> <p>For more information about space accounting, see <a href="chapter3.html#gbchp">ZFS Space Accounting</a>.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>canmount</tt> </p> </td><td valign="" align=""> <p>Boolean</p> </td><td valign="" align=""> <p>on</p> </td><td valign="" align=""> <p>Controls whether the given file system can be mounted with the <tt>zfs</tt> <tt>mount</tt> command. This property can be set on any file system and the property itself is not inheritable. However, when this property is set, a mountpoint can be inherited to descendent file systems, but the file system itself is never mounted. For more information, see <a href="chapter5.html#gdrcf">The canmount Property</a>.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>casesensitivity</tt> </p> </td><td valign="" align=""> <p>String</p> </td><td valign="" align=""> <p> <tt>sensitive</tt> </p> </td><td valign="" align=""> <p>This property indicates whether the file name matching algorithm used by the file system should be <tt>casesensitive</tt>,<tt> caseinsensitive</tt>, or allow a combination of both styles of matching (<tt>mixed</tt>). The default value for this property is <tt>sensitive</tt>. Traditionally, UNIX and POSIX file systems have case-sensitive file names.</p> <p>The <tt>mixed</tt> value for this property indicates the file system can support requests for both case-sensitive and case-insensitive matching behavior. Currently, case-insensitive matching behavior on a file system that supports mixed behavior is limited to the Solaris CIFS server product. For more information about using the <tt>mixed</tt> value, see <a href="chapter5.html#gftgr">The casesensitivity Property</a>.</p> <p>Regardless of the <tt>casesensitivity</tt> property setting, the file system preserves the case of the name specified to create a file. This property cannot be changed after the file system is created.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>checksum</tt> </p> </td><td valign="" align=""> <p>String</p> </td><td valign="" align=""> <p> <tt>on</tt> </p> </td><td valign="" align=""> <p>Controls the checksum used to verify data integrity. The default value is <tt>on</tt>, which automatically selects an appropriate algorithm, currently <tt>fletcher2</tt>. The values are <tt>on, off, fletcher2</tt>, <tt>fletcher4</tt>, and <tt>sha256</tt>. A value of <tt>off</tt> disables integrity checking on user data. A value of <tt>off</tt> is not recommended.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>compression</tt> </p> </td><td valign="" align=""> <p>String</p> </td><td valign="" align=""> <p> <tt>off</tt> </p> </td><td valign="" align=""> <p>Controls the compression algorithm used for this dataset. Currently, you can select <tt>lzjb</tt>, <tt>gzip</tt>, or <tt>gzip-</tt><tt><i>N</i></tt>. Enabling compression on a file system with existing data only compresses new data. Existing data remains uncompressed.</p> <p>This property can also be referred to by its shortened column name, <tt>compress</tt>.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>compressratio</tt> </p> </td><td valign="" align=""> <p>Number</p> </td><td valign="" align=""> <p>N/A</p> </td><td valign="" align=""> <p>Read-only property that identifies the compression ratio achieved for this dataset, expressed as a multiplier. Compression can be turned on by running <tt>zfs set compression=on</tt> <tt><i>dataset</i></tt>.</p> <p>Calculated from the logical size of all files and the amount of referenced physical data. Includes explicit savings through the use of the <tt>compression</tt> property.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>copies</tt> </p> </td><td valign="" align=""> <p>Number</p> </td><td valign="" align=""> <p>1</p> </td><td valign="" align=""> <p>Sets the number of copies of user data per file system. Available values are 1, 2 or 3. These copies are in addition to any pool-level redundancy. Space used by multiple copies of user data is charged to the corresponding file and dataset and counts against quotas and reservations. In addition, the <tt>used</tt> property is updated when multiple copies are enabled. Consider setting this property when the file system is created because changing this property on an existing file system only affects newly written data.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>creation</tt> </p> </td><td valign="" align=""> <p>Number</p> </td><td valign="" align=""> <p>N/A</p> </td><td valign="" align=""> <p>Read-only property that identifies the date and time that this dataset was created.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>devices</tt> </p> </td><td valign="" align=""> <p>Boolean</p> </td><td valign="" align=""> <p> <tt>on</tt> </p> </td><td valign="" align=""> <p>Controls the ability to open device files in the file system.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>exec</tt> </p> </td><td valign="" align=""> <p>Boolean</p> </td><td valign="" align=""> <p> <tt>on</tt> </p> </td><td valign="" align=""> <p>Controls whether programs within this file system are allowed to be executed. Also, when set to <tt>off</tt>, <tt>mmap(2)</tt> calls with <tt>PROT_EXEC</tt> are disallowed.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>mounted</tt> </p> </td><td valign="" align=""> <p>boolean</p> </td><td valign="" align=""> <p>N/A</p> </td><td valign="" align=""> <p>Read-only property that indicates whether this file system, clone, or snapshot is currently mounted. This property does not apply to volumes. Value can be either yes or no.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>mountpoint</tt> </p> </td><td valign="" align=""> <p>String</p> </td><td valign="" align=""> <p>N/A</p> </td><td valign="" align=""> <p>Controls the mount point used for this file system. When the <tt>mountpoint</tt> property is changed for a file system, the file system and any children that inherit the mount point are unmounted. If the new value is <tt>legacy</tt>, then they remain unmounted. Otherwise, they are automatically remounted in the new location if the property was previously <tt>legacy</tt> or <tt>none</tt>, or if they were mounted before the property was changed. In addition, any shared file systems are unshared and shared in the new location.</p> <p>For more information about using this property, see <a href="chapter5.html#gaztn">Managing ZFS Mount Points</a>.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>nbmand</tt> </p> </td><td valign="" align=""> <p>Boolean</p> </td><td valign="" align=""> <p>off</p> </td><td valign="" align=""> <p>Controls whether the file system should be mounted with <tt>nbmand</tt> (Non-blocking mandatory) locks. This property is for CIFS clients only. Changes to this property only take effect when the file system is unmounted and remounted. </p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>normalization</tt> </p> </td><td valign="" align=""> <p>String</p> </td><td valign="" align=""> <p>None</p> </td><td valign="" align=""> <p>This property indicates whether a file system should perform a unicode normalization of file names whenever two file names are compared, and which normalization algorithm should be used. File names are always stored unmodified, names are normalized as part of any comparison process. If this property is set to a legal value other than <tt>none</tt>, and the <tt>utf8only</tt> property was left unspecified, the <tt>utf8only</tt> property is automatically set to <tt>on</tt>. The default value of the <tt>normalization</tt> property is <tt>none</tt>. This property cannot be changed after the file system is created. </p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>origin</tt> </p> </td><td valign="" align=""> <p>String</p> </td><td valign="" align=""> <p>N/A</p> </td><td valign="" align=""> <p>Read-only property for cloned file systems or volumes that identifies the snapshot from which the clone was created. The origin cannot be destroyed (even with the <tt>r</tt> or <tt>f</tt> options) as long as a clone exists.</p> <p>Non-cloned file systems have an origin of none.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>quota</tt> </p> </td><td valign="" align=""> <p>Number (or <tt>none</tt>)</p> </td><td valign="" align=""> <p> <tt>none</tt> </p> </td><td valign="" align=""> <p>Limits the amount of space a dataset and its descendents can consume. This property enforces a hard limit on the amount of space used, including all space consumed by descendents, including file systems and snapshots. Setting a quota on a descendent of a dataset that already has a quota does not override the ancestor's quota, but rather imposes an additional limit. Quotas cannot be set on volumes, as the <tt>volsize</tt> property acts as an implicit quota.</p> <p>For information about setting quotas, see <a href="chapter5.html#gazud">Setting Quotas on ZFS File Systems</a>.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>readonly</tt> </p> </td><td valign="" align=""> <p>Boolean</p> </td><td valign="" align=""> <p> <tt>off</tt> </p> </td><td valign="" align=""> <p>Controls whether this dataset can be modified. When set to <tt>on</tt>, no modifications can be made to the dataset.</p> <p>This property can also be referred to by its shortened column name, <tt>rdonly</tt>.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>recordsize</tt> </p> </td><td valign="" align=""> <p>Number</p> </td><td valign="" align=""> <p> <tt>128K</tt> </p> </td><td valign="" align=""> <p>Specifies a suggested block size for files in the file system.</p> <p>This property can also be referred to by its shortened column name, <tt>recsize</tt>. For a detailed description, see <a href="chapter5.html#gcfgv">The recordsize Property</a>.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>referenced</tt> </p> </td><td valign="" align=""> <p>Number</p> </td><td valign="" align=""> <p>N/A</p> </td><td valign="" align=""> <p>Read-only property that identifies the amount of data accessible by this dataset, which might or might not be shared with other datasets in the pool.</p> <p>When a snapshot or clone is created, it initially references the same amount of space as the file system or snapshot it was created from, because its contents are identical.</p> <p>This property can also be referred to by its shortened column name, <tt>refer</tt>.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>refquota</tt> </p> </td><td valign="" align=""> <p>Number (or none)</p> </td><td valign="" align=""> <p>none</p> </td><td valign="" align=""> <p>Sets the amount of space that a dataset can consume. This property enforces a hard limit on the amount of space used. This hard limit does not include space used by descendents, such as snapshots and clones.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>refreservation</tt> </p> </td><td valign="" align=""> <p>Number (or none)</p> </td><td valign="" align=""> <p> <tt>none</tt> </p> </td><td valign="" align=""> <p>Sets the minimum amount of space that is guaranteed to a dataset, not including descendents, such as snapshots and clones. When the amount of space that is used is below this value, the dataset is treated as if it were taking up the amount of space specified by <tt>refreservation</tt>. The <tt>refreservation</tt> reservation is accounted for in the parent datasets' space used, and counts against the parent datasets' quotas and reservations.</p> <p>If <tt>refreservation</tt> is set, a snapshot is only allowed if enough free pool space is available outside of this reservation to accommodate the current number of <b>referenced</b> bytes in the dataset.</p> <p>This property can also be referred to by its shortened column name, <tt>refreserv</tt>.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>reservation</tt> </p> </td><td valign="" align=""> <p>Number (or none)</p> </td><td valign="" align=""> <p> <tt>none</tt> </p> </td><td valign="" align=""> <p>The minimum amount of space guaranteed to a dataset and its descendents. When the amount of space used is below this value, the dataset is treated as if it were using the amount of space specified by its reservation. Reservations are accounted for in the parent datasets' space used, and count against the parent datasets' quotas and reservations.</p> <p>This property can also be referred to by its shortened column name, <tt>reserv</tt>.</p> <p>For more information, see <a href="chapter5.html#gbdbb">Setting Reservations on ZFS File Systems</a>.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>setuid</tt> </p> </td><td valign="" align=""> <p>Boolean</p> </td><td valign="" align=""> <p> <tt>on</tt> </p> </td><td valign="" align=""> <p>Controls whether the <tt>setuid</tt> bit is honored in the file system.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>sharenfs</tt> </p> </td><td valign="" align=""> <p>String</p> </td><td valign="" align=""> <p> <tt>off</tt> </p> </td><td valign="" align=""> <p>Controls whether the file system is available over NFS, and what options are used. If set to <tt>on</tt>, the <tt>zfs share</tt> command is invoked with no options. Otherwise, the <tt>zfs share</tt> command is invoked with options equivalent to the contents of this property. If set to <tt>off</tt>, the file system is managed by using the legacy <tt>share</tt> and <tt>unshare</tt> commands and the <tt>dfstab</tt> file.</p> <p>For more information on sharing ZFS file systems, see <a href="chapter5.html#gamnd">Sharing and Unsharing ZFS File Systems</a>.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>sharesmb</tt> </p> </td><td valign="" align=""> <p>Boolean</p> </td><td valign="" align=""> <p>off</p> </td><td valign="" align=""> <p>Controls whether the file system is shared by using the Solaris CIFS service, and what options are to be used. A file system with the <tt>sharesmb</tt> property set to <tt>off</tt> is managed through traditional tools, such as the <tt>sharemgr</tt> command. Otherwise, the file system is automatically shared and unshared by using the <tt>zfs share</tt> and <tt>zfs unshare</tt> commands.</p> <p>If the property is set to <tt>on</tt>, the <tt>sharemgr</tt> command is invoked with no options. Otherwise, the <tt>sharemgr</tt> command is invoked with options that are equivalent to the contents of this property.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>snapdir</tt> </p> </td><td valign="" align=""> <p>String</p> </td><td valign="" align=""> <p> <tt>hidden</tt> </p> </td><td valign="" align=""> <p>Controls whether the <tt>.zfs</tt> directory is hidden or visible in the root of the file system. For more information on using snapshots, see <a href="chapter6.html#gbciq">Overview of ZFS Snapshots</a>.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>type</tt> </p> </td><td valign="" align=""> <p>String</p> </td><td valign="" align=""> <p>N/A</p> </td><td valign="" align=""> <p>Read-only property that identifies the dataset type as <tt>filesystem</tt> (file system or clone), <tt>volume</tt>, or <tt>snapshot</tt>.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>used</tt> </p> </td><td valign="" align=""> <p>Number</p> </td><td valign="" align=""> <p>N/A</p> </td><td valign="" align=""> <p>Read-only property that identifies the amount of space consumed by the dataset and all its descendents.</p> <p>For a detailed description, see <a href="chapter5.html#gcfgz">The used Property</a>.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>utf8only</tt> </p> </td><td valign="" align=""> <p>Boolean</p> </td><td valign="" align=""> <p>Off</p> </td><td valign="" align=""> <p>This property indicates whether a file system should reject file names that include characters that are not present in the UTF-8 character code set. If this property is explicitly set to <tt>off</tt>, the <tt>normalization</tt> property must either not be explicitly set or be set to <tt>none</tt>. The default value for the <tt>utf8only</tt> property is <tt>off</tt>. This property cannot be changed after the file system is created.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>volsize</tt> </p> </td><td valign="" align=""> <p>Number</p> </td><td valign="" align=""> <p>N/A</p> </td><td valign="" align=""> <p>For volumes, specifies the logical size of the volume.</p> <p>For a detailed description, see <a href="chapter5.html#gcfhk">The volsize Property</a>.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>volblocksize</tt> </p> </td><td valign="" align=""> <p>Number</p> </td><td valign="" align=""> <p>8 Kbytes</p> </td><td valign="" align=""> <p>For volumes, specifies the block size of the volume. The block size cannot be changed once the volume has been written, so set the block size at volume creation time. The default block size for volumes is 8 Kbytes. Any power of 2 from 512 bytes to 128 Kbytes is valid.</p> <p>This property can also be referred to by its shortened column name, <tt>volblock</tt>.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>vscan</tt> </p> </td><td valign="" align=""> <p>Boolean</p> </td><td valign="" align=""> <p>Off</p> </td><td valign="" align=""> <p>Controls whether regular files should be scanned for viruses when a file is opened and closed. In addition to enabling this property, a virus scanning service must also be enabled for virus scanning to occur. The default value is <tt>off</tt>.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>zoned</tt> </p> </td><td valign="" align=""> <p>Boolean</p> </td><td valign="" align=""> <p>N/A</p> </td><td valign="" align=""> <p>Indicates whether this dataset has been added to a non-global zone. If this property is set, then the mount point is not honored in the global zone, and ZFS cannot mount such a file system when requested. When a zone is first installed, this property is set for any added file systems.</p> <p>For more information about using ZFS with zones installed, see <a href="chapter9.html#gayov">Using ZFS on a Solaris System With Zones Installed</a>.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>xattr</tt> </p> </td><td valign="" align=""> <p>Boolean</p> </td><td valign="" align=""> <p> <tt>on</tt> </p> </td><td valign="" align=""> <p>Indicates whether extended attributes are enabled or disabled for this file system. The default value is <tt>on</tt>.</p> </td> </tr> </table> <a name="gazsy"></a> <h3>ZFS Read-Only Native Properties</h3> <p>Read-only native properties are properties that can be retrieved but cannot be set. Read-only native properties are not inherited. Some native properties are specific to a particular type of dataset. In such cases, the particular dataset type is mentioned in the description in <a href="chapter5.html#gcfgr">Table 5–1</a>.</p> <p>The read-only native properties are listed here and are described in <a href="chapter5.html#gcfgr">Table 5–1</a>.</p> <ul> <li> <p> <tt>available</tt> </p> </li> <li> <p> <tt>creation</tt> </p> </li> <li> <p> <tt>mounted</tt> </p> </li> <li> <p> <tt>origin</tt> </p> </li> <li> <p> <tt>compressratio</tt> </p> </li> <li> <p> <tt>referenced</tt> </p> </li> <li> <p> <tt>type</tt> </p> </li> <li> <p> <tt>used</tt> </p> <p>For detailed information, see <a href="chapter5.html#gcfgz">The used Property</a>.</p> </li> </ul> <p>For more information on space accounting, including the <tt>used</tt>, <tt>referenced</tt>, and <tt>available</tt> properties, see <a href="chapter3.html#gbchp">ZFS Space Accounting</a>.</p> <a name="gcfgz"></a> <h4>The used Property</h4> <p>The amount of space consumed by this dataset and all its descendents. This value is checked against the dataset's quota and reservation. The space used does not include the dataset's reservation, but does consider the reservation of any descendent datasets. The amount of space that a dataset consumes from its parent, as well as the amount of space that is freed if the dataset is recursively destroyed, is the greater of its space used and its reservation.</p> <p>When snapshots are created, their space is initially shared between the snapshot and the file system, and possibly with previous snapshots. As the file system changes, space that was previously shared becomes unique to the snapshot, and counted in the snapshot's space used. Additionally, deleting snapshots can increase the amount of space unique to (and used by) other snapshots. For more information about snapshots and space issues, see <a href="chapter3.html#gayra">Out of Space Behavior</a>.</p> <p>The amount of space used, available, or referenced does not take into account pending changes. Pending changes are generally accounted for within a few seconds. Committing a change to a disk using <tt>fsync(3c)</tt> or <tt>O_SYNC</tt> does not necessarily guarantee that the space usage information will be updated immediately.</p> <a name="gazsd"></a> <h3>Settable ZFS Native Properties</h3> <p>Settable native properties are properties whose values can be both retrieved and set. Settable native properties are set by using the <tt>zfs set</tt> command, as described in <a href="chapter5.html#gazsp">Setting ZFS Properties</a> or by using the <tt>zfs create</tt> command as described in <a href="chapter5.html#gazsf">Creating a ZFS File System</a>. With the exceptions of quotas and reservations, settable native properties are inherited. For more information about quotas and reservations, see <a href="chapter5.html#gazvb">ZFS Quotas and Reservations</a>.</p> <p>Some settable native properties are specific to a particular type of dataset. In such cases, the particular dataset type is mentioned in the description in <a href="chapter5.html#gcfgr">Table 5–1</a>. If not specifically mentioned, a property applies to all dataset types: file systems, volumes, clones, and snapshots.</p> <p>The settable properties are listed here and are described in <a href="chapter5.html#gcfgr">Table 5–1</a>.</p> <ul> <li> <p> <tt>aclinherit</tt> </p> <p>For a detailed description, see <a href="chapter7.html#gbaaz">ACL Property Modes</a>.</p> </li> <li> <p> <tt>aclmode</tt> </p> <p>For a detailed description, see <a href="chapter7.html#gbaaz">ACL Property Modes</a>.</p> </li> <li> <p> <tt>atime</tt> </p> </li> <li> <p> <tt>canmount</tt> </p> </li> <li> <p> <tt>casesensitivity</tt> </p> </li> <li> <p> <tt>checksum</tt> </p> </li> <li> <p> <tt>compression</tt> </p> </li> <li> <p> <tt>copies</tt> </p> </li> <li> <p> <tt>devices</tt> </p> </li> <li> <p> <tt>exec</tt> </p> </li> <li> <p> <tt>mountpoint</tt> </p> </li> <li> <p> <tt>nbmand</tt> </p> </li> <li> <p> <tt>normalization</tt> </p> </li> <li> <p> <tt>quota</tt> </p> </li> <li> <p> <tt>readonly</tt> </p> </li> <li> <p> <tt>recordsize</tt> </p> <p>For a detailed description, see <a href="chapter5.html#gcfgv">The recordsize Property</a>.</p> </li> <li> <p> <tt>refquota</tt> </p> </li> <li> <p> <tt>refreservation</tt> </p> </li> <li> <p> <tt>reservation</tt> </p> </li> <li> <p> <tt>sharenfs</tt> </p> </li> <li> <p> <tt>sharesmb</tt> </p> </li> <li> <p> <tt>setuid</tt> </p> </li> <li> <p> <tt>snapdir</tt> </p> </li> <li> <p> <tt>vscan</tt> </p> </li> <li> <p> <tt>utf8only</tt> </p> </li> <li> <p> <tt>volsize</tt> </p> <p>For a detailed description, see <a href="chapter5.html#gcfhk">The volsize Property</a>.</p> </li> <li> <p> <tt>volblocksize</tt> </p> </li> <li> <p> <tt>zoned</tt> </p> </li> </ul> <a name="gdrcf"></a> <h4>The canmount Property</h4> <p>If this property is set to no, the file system cannot be mounted by using the <tt>zfs mount</tt> or <tt>zfs mount</tt> <tt>a</tt> commands. This property is similar to setting the <tt>mountpoint</tt> property to <tt>none</tt>, except that the dataset still has a normal <tt>mountpoint</tt> property that can be inherited. For example, you can set this property to no, establish inheritable properties for descendent file systems, but the file system itself is never mounted nor it is accessible to users. In this case, the parent file system with this property set to no is serving as a <b>container</b> so that you can set attributes on the container, but the container itself is never accessible.</p> <p>In the following example, <tt>userpool</tt> is created and the <tt>canmount</tt> property is set to off. Mount points for descendent user file systems are set to one common mount point, <tt>/export/home</tt>. Properties that are set on the parent file system are inherited by descendent file systems, but the parent file system itself is never mounted.</p> <pre> <tt># <tt>zpool create userpool mirror c0t5d0 c1t6d0</tt> # <tt>zfs set canmount=off userpool</tt> # <tt>zfs set mountpoint=/export/home userpool</tt> # <tt>zfs set compression=on userpool</tt> # <tt>zfs create userpool/user1</tt> # <tt>zfs create userpool/user2</tt> # <tt>zfs list -r userpool</tt> NAME USED AVAIL REFER MOUNTPOINT userpool 140K 8.24G 24.5K /export/home userpool/user1 24.5K 8.24G 24.5K /export/home/user1 userpool/user2 24.5K 8.24G 24.5K /export/home/user2</tt> </pre> <a name="gftgr"></a> <h4>The casesensitivity Property</h4> <p>This property indicates whether the file name matching algorithm used by the file system should be <tt>casesensitive</tt>, <tt>caseinsensitive</tt>, or allow a combination of both styles of matching (<tt>mixed</tt>).</p> <p>When a case-insensitive matching request is made of a <b>mixed</b> sensitivity file system, the behavior is generally the same as would be expected of a purely case-insensitive file system. The difference is that a mixed sensitivity file system might contain directories with multiple names that are unique from a case-sensitive perspective, but not unique from the case-insensitive perspective.</p> <p>For example, a directory might contain files <tt>foo</tt>, <tt>Foo</tt>, and <tt>FOO</tt>. If a request is made to case-insensitively match any of the possible forms of <tt>foo</tt>, (for example <tt>foo</tt>, <tt>FOO</tt>, <tt>FoO</tt>, <tt>fOo</tt>, and so on) one of the three existing files is chosen as the match by the matching algorithm. Exactly which file the algorithm chooses as a match is not guaranteed, but what is guaranteed is that the same file is chosen as a match for any of the forms of <tt>foo</tt>. The file chosen as a case-insensitive match for <tt>foo</tt>, <tt>FOO</tt>, <tt>foO</tt>, <tt>Foo</tt>, and so on, is always the same, so long as the directory remains unchanged.</p> <p>The <tt>utf8only</tt>, <tt>normalization</tt>, and <tt>casesensitivity</tt> properties are also new permissions that can be assigned to non-privileged users by using ZFS delegated administration. For more information, see <a href="chapter8.html#gfkco">Delegating ZFS Permissions</a>.</p> <a name="gcfgv"></a> <h4>The recordsize Property</h4> <p>Specifies a suggested block size for files in the file system.</p> <p>This property is designed solely for use with database workloads that access files in fixed-size records. ZFS automatically adjust block sizes according to internal algorithms optimized for typical access patterns. For databases that create very large files but access the files in small random chunks, these algorithms may be suboptimal. Specifying a <tt>recordsize</tt> greater than or equal to the record size of the database can result in significant performance gains. Use of this property for general purpose file systems is strongly discouraged, and may adversely affect performance. The size specified must be a power of two greater than or equal to 512 and less than or equal to 128 Kbytes. Changing the file system's <tt>recordsize</tt> only affects files created afterward. Existing files are unaffected.</p> <p>This property can also be referred to by its shortened column name, <tt>recsize</tt>.</p> <a name="gfwpk"></a> <h4>The sharesmb Property</h4> <p>This property enabled sharing of ZFS file systems with the Solaris CIFS service, and identifies options to be used. </p> <p>Because SMB shares requires a resource name, a unique resource name is constructed from the dataset name. The constructed name is a copy of the dataset name except that the characters in the dataset name, which would be illegal in the resource name, are replaced with underscore (_) characters. A pseudo property <tt><i>name</i></tt> is also supported that allows you to replace the dataset name with a specific name. The specific name is then used to replace the prefix dataset in the case of inheritance.</p> <p>For example, if the dataset, <tt>data/home/john</tt>, is set to <tt>name=john</tt>, then <tt> data/home/john</tt> has a resource name of <tt>john</tt>. If a child dataset of <tt>data/home/john/backups</tt> exists, it has a resource name of <tt>john_backups</tt>. When the <tt>sharesmb</tt> property is changed for a dataset, the dataset and any children inheriting the property are re-shared with the new options, only if the property was previously set to <tt>off</tt>, or if they were shared before the property was changed. If the new property is set to <tt>off</tt>, the file systems are unshared.</p> <p>For examples of using the <tt>sharesmb</tt> property, see <a href="chapter5.html#gfwqv">Sharing ZFS Files in a Solaris CIFS Environment</a>.</p> <a name="gcfhk"></a> <h4>The volsize Property</h4> <p>The logical size of the volume. By default, creating a volume establishes a reservation for the same amount. Any changes to <tt>volsize</tt> are reflected in an equivalent change to the reservation. These checks are used to prevent unexpected behavior for users. A volume that contains less space than it claims is available can result in undefined behavior or data corruption, depending on how the volume is used. These effects can also occur when the volume size is changed while it is in use, particularly when you shrink the size. Extreme care should be used when adjusting the volume size.</p> <p>Though not recommended, you can create a sparse volume by specifying the <tt>s</tt> flag to <tt>zfs create -V</tt>, or by changing the reservation once the volume has been created. A <b>sparse volume</b> is defined as a volume where the reservation is not equal to the volume size. For a sparse volume, changes to <tt>volsize</tt> are not reflected in the reservation.</p> <p>For more information about using volumes, see <a href="chapter9.html#gaypf">ZFS Volumes</a>.</p> <a name="gdrcw"></a> <h3>ZFS User Properties</h3> <p>In addition to the standard native properties, ZFS supports arbitrary user properties. User properties have no effect on ZFS behavior, but you can use them to annotate datasets with information that is meaningful in your environment.</p> <p>User property names must conform to the following characteristics:</p> <ul> <li> <p>Contain a colon (':') character to distinguish them from native properties.</p> </li> <li> <p>Contain lowercase letters, numbers, and the following punctuation characters: ':', + ,'.', '_'. </p> </li> <li> <p>Maximum user property name is 256 characters.</p> </li> </ul> <p>The expected convention is that the property name is divided into the following two components but this namespace is not enforced by ZFS:</p> <pre> <tt><tt><i>module:property</i></tt></tt> </pre> <p>When making programmatic use of user properties, use a reversed DNS domain name for the <tt><i>module</i></tt> component of property names to reduce the chance that two independently-developed packages will use the same property name for different purposes. Property names that begin with "com.sun." are reserved for use by Sun Microsystems.</p> <p>The values of user properties have the following characteristics:</p> <ul> <li> <p>Arbitrary strings that are always inherited and are never validated.</p> </li> <li> <p>Maximum user property value is 1024 characters.</p> </li> </ul> <p>For example:</p> <pre> <tt># <tt>zfs set dept:users=finance userpool/user1</tt> # <tt>zfs set dept:users=general userpool/user2</tt> # <tt>zfs set dept:users=itops userpool/user3</tt></tt> </pre> <p>All of the commands that operate on properties, such as <tt>zfs list</tt>, <tt>zfs get</tt>, <tt>zfs set</tt>, and so on, can be used to manipulate both native properties and user properties.</p> <p>For example:</p> <pre> <tt><tt>zfs get -r dept:users userpool</tt> NAME PROPERTY VALUE SOURCE userpool dept:users all local userpool/user1 dept:users finance local userpool/user2 dept:users general local userpool/user3 dept:users itops local</tt> </pre> <p>To clear a user property, use the <tt>zfs inherit</tt> command. For example:</p> <pre> <tt># <tt>zfs inherit -r dept:users userpool</tt></tt> </pre> <p>If the property is not defined in any parent dataset, it is removed entirely.</p> <a name="gazsu"></a> <h3>Querying ZFS File System Information</h3> <p>The <tt>zfs list</tt> command provides an extensible mechanism for viewing and querying dataset information. Both basic and complex queries are explained in this section.</p> <a name="gaztd"></a> <h3>Listing Basic ZFS Information</h3> <p>You can list basic dataset information by using the <tt>zfs list</tt> command with no options. This command displays the names of all datasets on the system including their <tt>used</tt>, <tt>available</tt>, <tt>referenced</tt>, and <tt>mountpoint</tt> properties. For more information about these properties, see <a href="chapter5.html#gazss">Introducing ZFS Properties</a>.</p> <p>For example:</p> <pre> <tt># <tt>zfs list</tt> NAME USED AVAIL REFER MOUNTPOINT pool 476K 16.5G 21K /pool pool/clone 18K 16.5G 18K /pool/clone pool/home 296K 16.5G 19K /pool/home pool/home/marks 277K 16.5G 277K /pool/home/marks pool/home/marks@snap 0 - 277K - pool/test 18K 16.5G 18K /test</tt> </pre> <p>You can also use this command to display specific datasets by providing the dataset name on the command line. Additionally, use the <tt>r</tt> option to recursively display all descendents of that dataset. For example:</p> <pre> <tt># <tt>zfs list -r pool/home/marks</tt> NAME USED AVAIL REFER MOUNTPOINT pool/home/marks 277K 16.5G 277K /pool/home/marks pool/home/marks@snap 0 - 277K -</tt> </pre> <p>You use <tt>zfs list</tt> command with absolute pathnames for datasets, snapshots, and volumes. For example:</p> <pre> <tt># <tt>zfs list /pool/home/marks</tt> NAME USED AVAIL REFER MOUNTPOINT pool/home/marks 277K 16.5G 277K /pool/home/marks</tt> </pre> <p>The following example shows how to display <tt>tank/home/chua</tt> and all of its descendent datasets.</p> <pre> <tt># <tt>zfs list -r tank/home/chua</tt> NAME USED AVAIL REFER MOUNTPOINT tank/home/chua 26.0K 4.81G 10.0K /tank/home/chua tank/home/chua/projects 16K 4.81G 9.0K /tank/home/chua/projects tank/home/chua/projects/fs1 8K 4.81G 8K /tank/home/chua/projects/fs1 tank/home/chua/projects/fs2 8K 4.81G 8K /tank/home/chua/projects/fs2</tt> </pre> <p>For additional information about the <tt>zfs list</tt> command, see zfs1M.</p> <a name="gazsh"></a> <h3>Creating Complex ZFS Queries</h3> <p>The <tt>zfs list</tt> output can be customized by using of the <tt>o</tt>, <tt>f</tt>, and <tt>H</tt> options.</p> <p>You can customize property value output by using the <tt>o</tt> option and a comma-separated list of desired properties. Supply any dataset property as a valid value. For a list of all supported dataset properties, see <a href="chapter5.html#gazss">Introducing ZFS Properties</a>. In addition to the properties defined there, the <tt>o</tt> option list can also contain the literal <tt>name</tt> to indicate that the output should include the name of the dataset. </p> <p>The following example uses <tt>zfs list</tt> to display the dataset name, along with the <tt>sharenfs</tt> and <tt>mountpoint</tt> properties.</p> <pre> <tt># zfs list -o name,sharenfs,mountpoint NAME SHARENFS MOUNTPOINT tank off /tank tank/home on /tank/home tank/home/ahrens on /tank/home/ahrens tank/home/bonwick on /tank/home/bonwick tank/home/chua on /tank/home/chua tank/home/eschrock on legacy tank/home/moore on /tank/home/moore tank/home/tabriz ro /tank/home/tabriz</tt> </pre> <p>You can use the <tt>t</tt> option to specify the types of datasets to display. The valid types are described in the following table.</p> <a name="gbaje"></a> <h6>Types of ZFS Datasets</h6> <table cellpadding="8" cellspacing="2" border="1"> <tr> <th valign="" align=""> <p>Type</p> </th><th valign="" align=""> <p>Description</p> </th> </tr> <tr> <td valign="" align=""> <p> <tt>filesystem</tt> </p> </td><td valign="" align=""> <p>File systems and clones</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>volume</tt> </p> </td><td valign="" align=""> <p>Volumes</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>snapshot</tt> </p> </td><td valign="" align=""> <p>Snapshots</p> </td> </tr> </table> <p>The <tt>t</tt> options takes a comma-separated list of the types of datasets to be displayed. The following example uses the <tt>t</tt> and <tt>o</tt> options simultaneously to show the name and <tt>used</tt> property for all file systems:</p> <pre> <tt># <tt>zfs list -t filesystem -o name,used</tt> NAME USED pool 476K pool/clone 18K pool/home 296K pool/home/marks 277K pool/test 18K</tt> </pre> <p>You can use the <tt>H</tt> option to omit the <tt>zfs list</tt> header from the generated output. With the <tt>H</tt> option, all white space is output as tabs. This option can be useful when you need parseable output, for example, when scripting. The following example shows the output generated from using the <tt>zfs list</tt> command with the <tt>H</tt> option:</p> <pre> <tt># <tt>zfs list -H -o name</tt> pool pool/clone pool/home pool/home/marks pool/home/marks@snap pool/test</tt> </pre> <a name="gayns"></a> <h3>Managing ZFS Properties</h3> <p>Dataset properties are managed through the <tt>zfs</tt> command's <tt>set</tt>, <tt>inherit</tt>, and <tt>get</tt> subcommands.</p> <ul> <li> <p> <a href="chapter5.html#gazsp">Setting ZFS Properties</a> </p> </li> <li> <p> <a href="chapter5.html#gazup">Inheriting ZFS Properties</a> </p> </li> <li> <p> <a href="chapter5.html#gazuk">Querying ZFS Properties</a> </p> </li> </ul> <a name="gazsp"></a> <h3>Setting ZFS Properties</h3> <p>You can use the <tt>zfs set</tt> command to modify any settable dataset property. Or, you can use the <tt>zfs create</tt> command to set properties when the dataset is created. For a list of settable dataset properties, see <a href="chapter5.html#gazsd">Settable ZFS Native Properties</a>. The <tt>zfs set</tt> command takes a property/value sequence in the format of <tt><i>property</i></tt>=<tt><i>value</i></tt> and a dataset name.</p> <p>The following example sets the <tt>atime</tt> property to <tt>off</tt> for <tt>tank/home</tt>. Only one property can be set or modified during each <tt>zfs set</tt> invocation.</p> <pre> <tt># <tt>zfs set atime=off tank/home</tt></tt> </pre> <p>In addition, any file system property can be set when the file system is created. For example:</p> <pre> <tt># <tt>zfs create -o atime=off tank/home</tt></tt> </pre> <p>You can specify numeric properties by using the following easy to understand suffixes (in order of magnitude): <tt>BKMGTPEZ</tt>. Any of these suffixes can be followed by an optional <tt>b</tt>, indicating bytes, with the exception of the <tt>B</tt> suffix, which already indicates bytes. The following four invocations of <tt>zfs set</tt> are equivalent numeric expressions indicating that the <tt>quota</tt> property be set to the value of 50 Gbytes on the <tt>tank/home/marks</tt> file system:</p> <pre> <tt># <tt>zfs set quota=50G tank/home/marks</tt> # <tt>zfs set quota=50g tank/home/marks</tt> # <tt>zfs set quota=50GB tank/home/marks</tt> # <tt>zfs set quota=50gb tank/home/marks</tt></tt> </pre> <p>Values of non-numeric properties are case-sensitive and must be lowercase, with the exception of <tt>mountpoint</tt> and <tt>sharenfs</tt>. The values of these properties can have mixed upper and lower case letters.</p> <p>For more information about the <tt>zfs set</tt> command, see zfs1M.</p> <a name="gazup"></a> <h3>Inheriting ZFS Properties</h3> <p>All settable properties, with the exception of quotas and reservations, inherit their value from their parent, unless a quota or reservation is explicitly set on the child. If no ancestor has an explicit value set for an inherited property, the default value for the property is used. You can use the <tt>zfs inherit</tt> command to clear a property setting, thus causing the setting to be inherited from the parent.</p> <p>The following example uses the <tt>zfs set</tt> command to turn on compression for the <tt>tank/home/bonwick</tt> file system. Then, <tt>zfs inherit</tt> is used to unset the <tt>compression</tt> property, thus causing the property to inherit the default setting of <tt>off</tt>. Because neither <tt>home</tt> nor <tt>tank</tt> have the <tt>compression</tt> property set locally, the default value is used. If both had compression on, the value set in the most immediate ancestor would be used (<tt>home</tt> in this example).</p> <pre> <tt># <tt>zfs set compression=on tank/home/bonwick</tt> # <tt>zfs get -r compression tank</tt> NAME PROPERTY VALUE SOURCE tank compression off default tank/home compression off default tank/home/bonwick compression on local # <tt>zfs inherit compression tank/home/bonwick</tt> # <tt>zfs get -r compression tank</tt> NAME PROPERTY VALUE SOURCE tank compression off default tank/home compression off default tank/home/bonwick compression off default</tt> </pre> <p>The <tt>inherit</tt> subcommand is applied recursively when the <tt>r</tt> option is specified. In the following example, the command causes the value for the <tt>compression</tt> property to be inherited by <tt>tank/home</tt> and any descendents it might have.</p> <pre> <tt># <tt>zfs inherit -r compression tank/home</tt></tt> </pre> <hr> <p> <b>Note - </b> <p>Be aware that the use of the <tt>r</tt> option clears the current property setting for all descendent datasets.</p> </p> <hr> <p>For more information about the <tt>zfs</tt> command, see zfs1M.</p> <a name="gazuk"></a> <h3>Querying ZFS Properties</h3> <p>The simplest way to query property values is by using the <tt>zfs list</tt> command. For more information, see <a href="chapter5.html#gaztd">Listing Basic ZFS Information</a>. However, for complicated queries and for scripting, use the <tt>zfs get</tt> command to provide more detailed information in a customized format.</p> <p>You can use the <tt>zfs get</tt> command to retrieve any dataset property. The following example shows how to retrieve a single property on a dataset:</p> <pre> <tt># <tt>zfs get checksum tank/ws</tt> NAME PROPERTY VALUE SOURCE tank/ws checksum on default</tt> </pre> <p>The fourth column, <tt>SOURCE</tt>, indicates where this property value has been set from. The following table defines the meaning of the possible source values. </p> <a name="gbavh"></a> <h6>Possible SOURCE Values (zfs get)</h6> <table cellpadding="8" cellspacing="2" border="1"> <tr> <th valign="" align=""> <p>Source Value</p> </th><th valign="" align=""> <p>Description</p> </th> </tr> <tr> <td valign="" align=""> <p> <tt>default</tt> </p> </td><td valign="" align=""> <p>This property was never explicitly set for this dataset or any of its ancestors. The default value for this property is being used.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>inherited from</tt> <tt><i>dataset-name</i></tt> </p> </td><td valign="" align=""> <p>This property value is being inherited from the parent as specified by <tt><i>dataset-name</i></tt>.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>local</tt> </p> </td><td valign="" align=""> <p>This property value was explicitly set for this dataset by using <tt>zfs set</tt>.</p> </td> </tr> <tr> <td valign="" align=""> <p> <tt>temporary</tt> </p> </td><td valign="" align=""> <p>This property value was set by using the <tt>zfs mount</tt> <tt>o</tt> option and is only valid for the lifetime of the mount. For more information about temporary mount point properties, see <a href="chapter5.html#gamnt">Using Temporary Mount Properties</a>.</p> </td> </tr> <tr> <td valign="" align=""> <p>- (none)</p> </td><td valign="" align=""> <p>This property is a read-only property. Its value is generated by ZFS.</p> </td> </tr> </table> <p>You can use the special keyword <tt>all</tt> to retrieve all dataset properties. The following example uses the <tt>all</tt> keyword to retrieve all existing dataset properties:</p> <pre> <tt># <tt>zfs get all tank</tt> NAME PROPERTY VALUE SOURCE tank type filesystem - tank creation Wed Jan 23 9:57 2008 - tank used 120K - tank available 33.1G - tank referenced 24.0K - tank compressratio 1.00x - tank mounted yes - tank quota none default tank reservation none default tank recordsize 128K default tank mountpoint /tank default tank sharenfs off default tank checksum on default tank compression off default tank atime on default tank devices on default tank exec on default tank setuid on default tank readonly off default tank zoned off default tank snapdir hidden default tank aclmode groupmask default tank aclinherit secure default tank canmount on default tank shareiscsi off default tank xattr on default tank copies 1 default tank version 3 - tank utf8only off - tank normalization none - tank casesensitivity sensitive - tank vscan off default tank nbmand off default tank sharesmb off default tank refquota none default tank refreservation none default</tt> </pre> <p>The <tt>s</tt> option to <tt>zfs get</tt> enables you to specify, by source value, the type of properties to display. This option takes a comma-separated list indicating the desired source types. Only properties with the specified source type are displayed. The valid source types are <tt>local</tt>, <tt>default</tt>, <tt>inherited</tt>, <tt>temporary</tt>, and <tt>none</tt>. The following example shows all properties that have been locally set on <tt>pool</tt>.</p> <pre> <tt># <tt>zfs get -s local all pool</tt> NAME PROPERTY VALUE SOURCE pool compression on local</tt> </pre> <p>Any of the above options can be combined with the <tt>r</tt> option to recursively display the specified properties on all children of the specified dataset. In the following example, all temporary properties on all datasets within <tt>tank</tt> are recursively displayed:</p> <pre> <tt># <tt>zfs get -r -s temporary all tank</tt> NAME PROPERTY VALUE SOURCE tank/home atime off temporary tank/home/bonwick atime off temporary tank/home/marks atime off temporary</tt> </pre> <p>A recent feature enables you to make queries with the <tt>zfs get</tt> command without specifying a target file system, which means it operates on all pools or file systems. For example:</p> <pre> <tt># <tt>zfs get -s local all</tt> tank/home atime off local tank/home/bonwick atime off local tank/home/marks quota 50G local</tt> </pre> <p>For more information about the <tt>zfs get</tt> command, see zfs1M.</p> <a name="gazum"></a> <h4>Querying ZFS Properties for Scripting</h4> <p>The <tt>zfs get</tt> command supports the <tt>H</tt> and <tt>o</tt> options, which are designed for scripting. The <tt>H</tt> option indicates that any header information should be omitted and that all white space should come in the form of tab. Uniform white space allows for easily parseable data. You can use the <tt>o</tt> option to customize the output. This option takes a comma-separated list of values to be output. All properties defined in <a href="chapter5.html#gazss">Introducing ZFS Properties</a>, along with the literals <tt>name</tt>, <tt>value</tt>, <tt>property</tt> and <tt>source</tt> can be supplied in the <tt>o</tt> list.</p> <p>The following example shows how to retrieve a single value by using the <tt>H</tt> and <tt>o</tt> options of <tt>zfs get</tt>.</p> <pre> <tt># <tt>zfs get -H -o value compression tank/home</tt> on</tt> </pre> <p>The <tt>p</tt> option reports numeric values as their exact values. For example, 1 Mbyte would be reported as 1000000. This option can be used as follows:</p> <pre> <tt># <tt>zfs get -H -o value -p used tank/home</tt> 182983742</tt> </pre> <p>You can use the <tt>r</tt> option along with any of the above options to recursively retrieve the requested values for all descendents. The following example uses the <tt>r</tt>, <tt>o</tt>, and <tt>H</tt> options to retrieve the dataset name and the value of the <tt>used</tt> property for <tt>export/home</tt> and its descendents, while omitting any header output:</p> <pre> <tt># <tt>zfs get -H -o name,value -r used export/home</tt> export/home 5.57G export/home/marks 1.43G export/home/maybee 2.15G</tt> </pre> <a name="gaynd"></a> <h3>Mounting and Sharing ZFS File Systems</h3> <p>This section describes how mount points and shared file systems are managed in ZFS.</p> <ul> <li> <p> <a href="chapter5.html#gaztn">Managing ZFS Mount Points</a> </p> </li> <li> <p> <a href="chapter5.html#gamns">Mounting ZFS File Systems</a> </p> </li> <li> <p> <a href="chapter5.html#gamnt">Using Temporary Mount Properties</a> </p> </li> <li> <p> <a href="chapter5.html#gamnr">Unmounting ZFS File Systems</a> </p> </li> <li> <p> <a href="chapter5.html#gamnd">Sharing and Unsharing ZFS File Systems</a> </p> </li> </ul> <a name="gaztn"></a> <h3>Managing ZFS Mount Points</h3> <p>By default, all ZFS file systems are mounted by ZFS at boot by using SMF's <tt>svc://system/filesystem/local</tt> service. File systems are mounted under <tt><i>/path</i></tt>, where <tt><i>path</i></tt> is the name of the file system.</p> <p>You can override the default mount point by setting the <tt>mountpoint</tt> property to a specific path by using the <tt>zfs set</tt> command. ZFS automatically creates this mount point, if needed, and automatically mounts this file system when the <tt>zfs mount -a</tt> command is invoked, without requiring you to edit the <tt>/etc/vfstab</tt> file.</p> <p>The <tt>mountpoint</tt> property is inherited. For example, if <tt>pool/home</tt> has <tt>mountpoint</tt> set to <tt>/export/stuff</tt>, then <tt>pool/home/user</tt> inherits <tt>/export/stuff/user</tt> for its <tt>mountpoint</tt> property.</p> <p>The <tt>mountpoint</tt> property can be set to <tt>none</tt> to prevent the file system from being mounted. In addition, the <tt>canmount</tt> property is available for determining whether a file system can be mounted. For more information about the <tt>canmount</tt> property, see <a href="chapter5.html#gdrcf">The canmount Property</a>.</p> <p>If desired, file systems can also be explicitly managed through legacy mount interfaces by setting the <tt>mountpoint</tt> property to <tt>legacy</tt> by using <tt>zfs set</tt>. Doing so prevents ZFS from automatically mounting and managing this file system. Legacy tools including the <tt>mount</tt> and <tt>umount</tt> commands, and the <tt>/etc/vfstab</tt> file must be used instead. For more information about legacy mounts, see <a href="chapter5.html#gbaln">Legacy Mount Points</a>.</p> <p>When changing mount point management strategies, the following behaviors apply:</p> <ul> <li> <p>Automatic mount point behavior</p> </li> <li> <p>Legacy mount point behavior</p> </li> </ul> <a name="gbala"></a> <h4>Automatic Mount Points</h4> <ul> <li> <p>When changing from <tt>legacy</tt> or <tt>none</tt>, ZFS automatically mounts the file system.</p> </li> <li> <p>If ZFS is currently managing the file system but it is currently unmounted, and the <tt>mountpoint</tt> property is changed, the file system remains unmounted.</p> </li> </ul> <p>You can also set the default mount point for the root dataset at creation time by using <tt>zpool create</tt>'s <tt>m</tt> option. For more information about creating pools, see <a href="chapter4.html#gaynr">Creating a ZFS Storage Pool</a>.</p> <p>Any dataset whose <tt>mountpoint</tt> property is not <tt>legacy</tt> is managed by ZFS. In the following example, a dataset is created whose mount point is automatically managed by ZFS.</p> <pre> <tt># <tt>zfs create pool/filesystem</tt> # <tt>zfs get mountpoint pool/filesystem</tt> NAME PROPERTY VALUE SOURCE pool/filesystem mountpoint /pool/filesystem default # <tt>zfs get mounted pool/filesystem</tt> NAME PROPERTY VALUE SOURCE pool/filesystem mounted yes -</tt> </pre> <p>You can also explicitly set the <tt>mountpoint</tt> property as shown in the following example:</p> <pre> <tt># <tt>zfs set mountpoint=/mnt pool/filesystem</tt> # <tt>zfs get mountpoint pool/filesystem</tt> NAME PROPERTY VALUE SOURCE pool/filesystem mountpoint /mnt local # <tt>zfs get mounted pool/filesystem</tt> NAME PROPERTY VALUE SOURCE pool/filesystem mounted yes -</tt> </pre> <p>When the <tt>mountpoint</tt> property is changed, the file system is automatically unmounted from the old mount point and remounted to the new mount point. Mount point directories are created as needed. If ZFS is unable to unmount a file system due to it being active, an error is reported and a forced manual unmount is necessary.</p> <a name="gbaln"></a> <h4>Legacy Mount Points</h4> <p>You can manage ZFS file systems with legacy tools by setting the <tt>mountpoint</tt> property to <tt>legacy</tt>. Legacy file systems must be managed through the <tt>mount</tt> and <tt>umount</tt> commands and the <tt>/etc/vfstab</tt> file. ZFS does not automatically mount legacy file systems on boot, and the ZFS <tt>mount</tt> and <tt>umount</tt> command do not operate on datasets of this type. The following examples show how to set up and manage a ZFS dataset in legacy mode:</p> <pre> <tt># <tt>zfs set mountpoint=legacy tank/home/eschrock</tt> # <tt>mount -F zfs tank/home/eschrock /mnt</tt></tt> </pre> <p>In addition, you must mount them by creating entries in the <tt>/etc/vfstab</tt> file. Otherwise, the <tt>system/filesystem/local</tt> service enters maintenance mode when the system boots.</p> <p>To automatically mount a legacy file system on boot, you must add an entry to the <tt>/etc/vfstab</tt> file. The following example shows what the entry in the <tt>/etc/vfstab</tt> file might look like:</p> <pre> <tt>#device device mount FS fsck mount mount #to mount to fsck point type pass at boot options # tank/home/eschrock - /mnt zfs - yes - </tt> </pre> <p>Note that the <tt>device to fsck</tt> and <tt>fsck pass</tt> entries are set to <tt>-</tt>. This syntax is because the <tt>fsck</tt> command is not applicable to ZFS file systems. For more information regarding data integrity and the lack of need for <tt>fsck</tt> in ZFS, see <a href="chapter.html#gaypi">Transactional Semantics</a>.</p> <a name="gamns"></a> <h3>Mounting ZFS File Systems</h3> <p>ZFS automatically mounts file systems when file systems are created or when the system boots. Use of the <tt>zfs mount</tt> command is necessary only when changing mount options or explicitly mounting or unmounting file systems.</p> <p>The <tt>zfs mount</tt> command with no arguments shows all currently mounted file systems that are managed by ZFS. Legacy managed mount points are not displayed. For example:</p> <pre> <tt># <tt>zfs mount</tt> tank /tank tank/home /tank/home tank/home/bonwick /tank/home/bonwick tank/ws /tank/ws</tt> </pre> <p>You can use the <tt>a</tt> option to mount all ZFS managed file systems. Legacy managed file systems are not mounted. For example:</p> <pre> <tt># <tt>zfs mount -a</tt></tt> </pre> <p>By default, ZFS does not allow mounting on top of a nonempty directory. To force a mount on top of a nonempty directory, you must use the <tt>O</tt> option. For example:</p> <pre> <tt># <tt>zfs mount tank/home/lalt</tt> cannot mount '/export/home/lalt': directory is not empty use legacy mountpoint to allow this behavior, or use the -O flag # <tt>zfs mount -O tank/home/lalt</tt></tt> </pre> <p>Legacy mount points must be managed through legacy tools. An attempt to use ZFS tools results in an error. For example:</p> <pre> <tt># <tt>zfs mount pool/home/billm</tt> cannot mount 'pool/home/billm': legacy mountpoint use mount(1M) to mount this filesystem # <tt>mount -F zfs tank/home/billm</tt></tt> </pre> <p>When a file system is mounted, it uses a set of mount options based on the property values associated with the dataset. The correlation between properties and mount options is as follows:</p> <dl> <dt>Property</dt> <dd> <p>Mount Options</p> </dd> <dt> <tt>devices</tt> </dt> <dd> <p> <tt>devices/nodevices</tt> </p> </dd> <dt> <tt>exec</tt> </dt> <dd> <p> <tt>exec/noexec</tt> </p> </dd> <dt> <tt>readonly</tt> </dt> <dd> <p> <tt>ro/rw</tt> </p> </dd> <dt> <tt>setuid</tt> </dt> <dd> <p> <tt>setuid/nosetuid</tt> </p> </dd> </dl> <p>The mount option <tt>nosuid</tt> is an alias for <tt>nodevices,nosetuid</tt>.</p> <p>You can use the NFSv4 mirror mount features to help you better manage NFS-mounted ZFS home directories. For a description of mirror mounts, see <a href="chapter.html#gfwqw">ZFS and File System Mirror Mounts</a>.</p> <a name="gamnt"></a> <h3>Using Temporary Mount Properties</h3> <p>If any of the above options are set explicitly by using the<tt>o</tt> option with the <tt>zfs mount</tt> command, the associated property value is temporarily overridden. These property values are reported as <tt>temporary</tt> by the <tt>zfs get</tt> command and revert back to their original settings when the file system is unmounted. If a property value is changed while the dataset is mounted, the change takes effect immediately, overriding any temporary setting.</p> <p>In the following example, the read-only mount option is temporarily set on the <tt>tank/home/perrin</tt> file system:</p> <pre> <tt># <tt>zfs mount -o ro tank/home/perrin</tt></tt> </pre> <p>In this example, the file system is assumed to be unmounted. To temporarily change a property on a file system that is currently mounted, you must use the special <tt>remount</tt> option. In the following example, the <tt>atime</tt> property is temporarily changed to <tt>off</tt> for a file system that is currently mounted:</p> <pre> <tt># <tt>zfs mount -o remount,noatime tank/home/perrin</tt> # <tt>zfs get atime tank/home/perrin</tt> NAME PROPERTY VALUE SOURCE tank/home/perrin atime off temporary</tt> </pre> <p>For more information about the <tt>zfs mount</tt> command, see zfs1M.</p> <a name="gamnr"></a> <h3>Unmounting ZFS File Systems</h3> <p>You can unmount file systems by using the <tt>zfs unmount</tt> subcommand. The <tt>unmount</tt> command can take either the mount point or the file system name as arguments.</p> <p>In the following example, a file system is unmounted by file system name:</p> <pre> <tt># <tt>zfs unmount tank/home/tabriz</tt></tt> </pre> <p>In the following example, the file system is unmounted by mount point:</p> <pre> <tt># <tt>zfs unmount /export/home/tabriz</tt></tt> </pre> <p>The <tt>unmount</tt> command fails if the file system is active or busy. To forceably unmount a file system, you can use the <tt>f</tt> option. Be cautious when forceably unmounting a file system, if its contents are actively being used. Unpredictable application behavior can result.</p> <pre> <tt># <tt>zfs unmount tank/home/eschrock</tt> cannot unmount '/export/home/eschrock': Device busy # <tt>zfs unmount -f tank/home/eschrock</tt></tt> </pre> <p>To provide for backwards compatibility, the legacy <tt>umount</tt> command can be used to unmount ZFS file systems. For example:</p> <pre> <tt># <tt>umount /export/home/bob</tt></tt> </pre> <p>For more information about the <tt>zfs umount</tt> command, see zfs1M.</p> <a name="gamnd"></a> <h3>Sharing and Unsharing ZFS File Systems</h3> <p>Similar to mount points, ZFS can automatically share file systems by using the <tt>sharenfs</tt> property. Using this method, you do not have to modify the <tt>/etc/dfs/dfstab</tt> file when a new file system is added. The <tt>sharenfs</tt> property is a comma-separated list of options to pass to the <tt>share</tt> command. The special value <tt>on</tt> is an alias for the default share options, which are <tt>read/write</tt> permissions for anyone. The special value <tt>off</tt> indicates that the file system is not managed by ZFS and can be shared through traditional means, such as the <tt>/etc/dfs/dfstab</tt> file. All file systems whose <tt>sharenfs</tt> property is not <tt>off</tt> are shared during boot.</p> <a name="gbdxz"></a> <h4>Controlling Share Semantics</h4> <p>By default, all file systems are unshared. To share a new file system, use <tt>zfs set</tt> syntax similar to the following:</p> <pre> <tt># <tt>zfs set sharenfs=on tank/home/eschrock</tt></tt> </pre> <p>The property is inherited, and file systems are automatically shared on creation if their inherited property is not <tt>off</tt>. For example:</p> <pre> <tt># <tt>zfs set sharenfs=on tank/home</tt> # <tt>zfs create tank/home/bricker</tt> # <tt>zfs create tank/home/tabriz</tt> # <tt>zfs set sharenfs=ro tank/home/tabriz</tt></tt> </pre> <p>Both <tt>tank/home/bricker</tt> and <tt>tank/home/tabriz</tt> are initially shared writable because they inherit the <tt>sharenfs</tt> property from <tt>tank/home</tt>. Once the property is set to <tt>ro</tt> (readonly), <tt>tank/home/tabriz</tt> is shared read-only regardless of the <tt>sharenfs</tt> property that is set for <tt>tank/home</tt>.</p> <a name="gbdze"></a> <h4>Unsharing ZFS File Systems</h4> <p>While most file systems are automatically shared and unshared during boot, creation, and destruction, file systems sometimes need to be explicitly unshared. To do so, use the <tt>zfs unshare</tt> command. For example:</p> <pre> <tt># <tt>zfs unshare tank/home/tabriz</tt></tt> </pre> <p>This command unshares the <tt>tank/home/tabriz</tt> file system. To unshare all ZFS file systems on the system, you need to use the <tt>a</tt> option.</p> <pre> <tt># <tt>zfs unshare -a</tt></tt> </pre> <a name="gbdxw"></a> <h4>Sharing ZFS File Systems</h4> <p>Most of the time the automatic behavior of ZFS, sharing on boot and creation, is sufficient for normal operation. If, for some reason, you unshare a file system, you can share it again by using the <tt>zfs share</tt> command. For example:</p> <pre> <tt># <tt>zfs share tank/home/tabriz</tt></tt> </pre> <p>You can also share all ZFS file systems on the system by using the <tt>a</tt> option.</p> <pre> <tt># <tt>zfs share -a</tt></tt> </pre> <a name="gbdxq"></a> <h4>Legacy Share Behavior</h4> <p>If the <tt>sharenfs</tt> property is <tt>off</tt>, then ZFS does not attempt to share or unshare the file system at any time. This setting enables you to administer through traditional means such as the <tt>/etc/dfs/dfstab</tt> file.</p> <p>Unlike the traditional <tt>mount</tt> command, the traditional <tt>share</tt> and <tt>unshare</tt> commands can still function on ZFS file systems. As a result, you can manually share a file system with options that are different from the settings of the <tt>sharenfs</tt> property. This administrative model is discouraged. Choose to either manage NFS shares completely through ZFS or completely through the <tt>/etc/dfs/dfstab</tt> file. The ZFS administrative model is designed to be simpler and less work than the traditional model. However, in some cases, you might still want to control file system sharing behavior through the familiar model.</p> <a name="gfwqv"></a> <h3>Sharing ZFS Files in a Solaris CIFS Environment</h3> <p>The <tt>sharesmb</tt> property is provided to share ZFS files by using the Solaris CIFS software product. When this property is set on a ZFS file system, these shares are visible to CIFS client systems. For more information about using the CIFS software product, see the System Administration Guide: Windows Interoperability.</p> <p>For a detailed description of the <tt>sharesmb</tt> property, see <a href="chapter5.html#gfwpk">The sharesmb Property</a>.</p> <a name="gfwqk"></a> <p> <b>Example—Sharing ZFS File Systems (sharesmb)</b> </p> <h4>Example—Sharing ZFS File Systems (sharesmb)</h4> <p>In this example, a ZFS file system <tt>sandbox/fs1</tt> is created and shared with the <tt>sharesmb</tt> property. If necessary, enable the SMB services.</p> <pre> <tt># svcadm enable -r smb/server svcadm: svc:/milestone/network depends on svc:/network/physical, which has multiple instances. # svcs | grep smb online 10:47:15 svc:/network/smb/server:default</tt> </pre> <pre> <tt># <tt>zpool create sandbox mirror c0t2d0 c0t4d0</tt> # <tt>zfs create sandbox/fs1</tt> # <tt>zfs set sharesmb=on sandbox/fs1</tt></tt> </pre> <p>The <tt>sharesmb</tt> property is set for <tt>sandbox/fs1</tt> and its descendents.</p> <p>Verify that the file system was shared. For example:</p> <pre> <tt># <tt>sharemgr show -vp</tt> default nfs=() zfs nfs=() zfs/sandbox/fs1 smb=() sandbox_fs1=/sandbox/fs1</tt> </pre> <p>A default SMB resource name, <tt>sandbox_fs1</tt>, is assigned automatically.</p> <p>In this example, another file system is created, <tt>sandbox/fs2</tt>, and shared with a resource name, <tt>myshare</tt>.</p> <pre> <tt># <tt>zfs create sandbox/fs2</tt> # <tt>zfs set sharesmb=name=myshare sandbox/fs2</tt> # <tt>sharemgr show -vp</tt> default nfs=() zfs nfs=() zfs/sandbox/fs1 smb=() sandbox_fs1=/sandbox/fs1 zfs/sandbox/fs2 smb=() myshare=/sandbox/fs2</tt> </pre> <p>The <tt>sandbox/fs2/fs2_sub1</tt> file system is created and is automatically shared. The inherited resource name is <tt>myshare_fs2_sub1</tt>.</p> <pre> <tt># <tt>zfs create sandbox/fs2/fs2_sub1</tt> # <tt>sharemgr show -vp</tt> default nfs=() zfs nfs=() zfs/sandbox/fs1 smb=() sandbox_fs1=/sandbox/fs1 zfs/sandbox/fs2 smb=() myshare=/sandbox/fs2 myshare_fs2_sub1=/sandbox/fs2/fs2_sub1</tt> </pre> <p>Disable SMB sharing for <tt>sandbox/fs2</tt> and its descendents.</p> <pre> <tt># <tt>zfs set sharesmb=off sandbox/fs2</tt> # <tt>sharemgr show -vp</tt> default nfs=() zfs nfs=() zfs/sandbox/fs1 smb=() sandbox_fs1=/sandbox/fs1</tt> </pre> <p>In this example, the <tt>sharesmb</tt> property is set on the pool's top-level file system. The descendent file systems are automatically shared.</p> <pre> <tt># <tt>zpool create sandbox mirror c0t2d0 c0t4d0</tt> # <tt>zfs set sharesmb=on sandbox</tt> # <tt>zfs create sandbox/fs1</tt> # <tt>zfs create sandbox/fs2</tt></tt> </pre> <p>The top-level file system has a resource name of <tt>sandbox</tt>, but the descendents have their dataset name appended to the resource name.</p> <pre> <tt># <tt>sharemgr show -vp</tt> default nfs=() zfs nfs=() zfs/sandbox smb=() sandbox=/sandbox sandbox_fs1=/sandbox/fs1 smb=() sandbox_fs2=/sandbox/fs2 smb=()</tt> </pre> <a name="gazvb"></a> <h3>ZFS Quotas and Reservations</h3> <p>ZFS supports quotas and reservations at the file system level. You can use the <tt>quota</tt> property to set a limit on the amount of space a file system can use. In addition, you can use the <tt>reservation</tt> property to guarantee that some amount of space is available to a file system. Both properties apply to the dataset they are set on and all descendents of that dataset.</p> <p>That is, if a quota is set on the <tt>tank/home</tt> dataset, the total amount of space used by <tt>tank/home</tt> <b>and all of its descendents</b> cannot exceed the quota. Similarly, if <tt>tank/home</tt> is given a reservation, <tt>tank/home</tt> <b>and all of its descendents</b> draw from that reservation. The amount of space used by a dataset and all of its descendents is reported by the <tt>used</tt> property.</p> <p>In addition to the <tt>quota</tt> and <tt>reservation</tt> property, the <tt>refquota</tt> and <tt>refreservation</tt> properties are available to manage file system space without accounting for space consumed by descendents, such as snapshots and clones.</p> <p>Consider the following points to determine which quota and reservations features might better manage your file systems:</p> <ul> <li> <p>The <tt>quota</tt> and <tt>reservation</tt> properties are convenient for managing space consumed by datasets.</p> </li> <li> <p>The <tt>refquota</tt> and <tt>refreservation</tt> properties are appropriate for managing space consumed by datasets and snapshots. </p> </li> <li> <p>Setting <tt>refquota</tt> or <tt>refreservation</tt> higher than quota or reservation have no effect. If you set the <tt>quota</tt> or <tt>refquota</tt> properties, operations that try to exceed either value fail. It is possible to a exceed a <tt>quota</tt> that is greater than <tt>refquota</tt>. If some snapshot blocks are dirtied, you might actually exceed the <tt>quota</tt> before you exceed the <tt>refquota</tt>.</p> </li> </ul> <p>For more information, see the examples below.</p> <a name="gazud"></a> <h3>Setting Quotas on ZFS File Systems</h3> <p>ZFS quotas can be set and displayed by using the <tt>zfs set</tt> and <tt>zfs get</tt> commands. In the following example, a quota of 10 Gbytes is set on <tt>tank/home/bonwick</tt>.</p> <pre> <tt># <tt>zfs set quota=10G tank/home/bonwick</tt> # <tt>zfs get quota tank/home/bonwick</tt> NAME PROPERTY VALUE SOURCE tank/home/bonwick quota 10.0G local</tt> </pre> <p>ZFS quotas also impact the output of the <tt>zfs list</tt> and <tt>df</tt> commands. For example:</p> <pre> <tt># <tt>zfs list</tt> NAME USED AVAIL REFER MOUNTPOINT tank/home 16.5K 33.5G 8.50K /export/home tank/home/bonwick 15.0K 10.0G 8.50K /export/home/bonwick tank/home/bonwick/ws 6.50K 10.0G 8.50K /export/home/bonwick/ws # <tt>df -h /export/home/bonwick</tt> Filesystem size used avail capacity Mounted on tank/home/bonwick 10G 8K 10G 1% /export/home/bonwick</tt> </pre> <p>Note that although <tt>tank/home</tt> has 33.5 Gbytes of space available, <tt>tank/home/bonwick</tt> and <tt>tank/home/bonwick/ws</tt> only have 10 Gbytes of space available, due to the quota on <tt>tank/home/bonwick</tt>.</p> <p>You cannot set a quota to an amount less than is currently being used by a dataset. For example:</p> <pre> <tt># <tt>zfs set quota=10K tank/home/bonwick</tt> cannot set quota for 'tank/home/bonwick': size is less than current used or reserved space</tt> </pre> <p>You can set a <tt>refquota</tt> on a dataset that limits the amount of space that the dataset can consume. This hard limit does not include space that is consumed by snapshots and clones. For example:</p> <pre> <tt># <tt>zfs set refquota=10g students/studentA</tt> # <tt>zfs list</tt> NAME USED AVAIL REFER MOUNTPOINT profs 106K 33.2G 18K /profs students 57.7M 33.2G 19K /students students/studentA 57.5M 9.94G 57.5M /students/studentA # <tt>zfs snapshot students/studentA@today</tt> # <tt>zfs list</tt> NAME USED AVAIL REFER MOUNTPOINT profs 106K 33.2G 18K /profs students 57.7M 33.2G 19K /students students/studentA 57.5M 9.94G 57.5M /students/studentA students/studentA@today 0 - 57.5M -</tt> </pre> <p>For additional convenience, you can set another quota on a dataset to help manage the space that is consumed by snapshots. For example:</p> <pre> <tt># <tt>zfs set quota=20g students/studentA</tt> # <tt>zfs list</tt> NAME USED AVAIL REFER MOUNTPOINT profs 106K 33.2G 18K /profs students 57.7M 33.2G 19K /students students/studentA 57.5M 9.94G 57.5M /students/studentA students/studentA@today 0 - 57.5M -</tt> </pre> <p>In this scenario, <tt>studentA</tt> can bump into the refquota (10 Gbytes) hard limit and remove files to recover even if snapshots exist.</p> <p>In the above example, the smaller of the two quotas (10 Gbytes versus 20 Gbytes) is displayed in the <tt>zfs list</tt> output. To see the value of both quotas, use the <tt>zfs get</tt> command. For example:</p> <pre> <tt># <tt>zfs get refquota,quota students/studentA</tt> NAME PROPERTY VALUE SOURCE students/studentA refquota 10G local students/studentA quota 20G local</tt> </pre> <a name="gbdbb"></a> <h3>Setting Reservations on ZFS File Systems</h3> <p>A ZFS <b>reservation</b> is an allocation of space from the pool that is guaranteed to be available to a dataset. As such, you cannot reserve space for a dataset if that space is not currently available in the pool. The total amount of all outstanding unconsumed reservations cannot exceed the amount of unused space in the pool. ZFS reservations can be set and displayed by using the <tt>zfs set</tt> and <tt>zfs get</tt> commands. For example:</p> <pre> <tt># <tt>zfs set reservation=5G tank/home/moore</tt> # <tt>zfs get reservation tank/home/moore</tt> NAME PROPERTY VALUE SOURCE tank/home/moore reservation 5.00G local</tt> </pre> <p>ZFS reservations can affect the output of the <tt>zfs list</tt> command. For example:</p> <pre> <tt># <tt>zfs list</tt> NAME USED AVAIL REFER MOUNTPOINT tank/home 5.00G 33.5G 8.50K /export/home tank/home/moore 15.0K 10.0G 8.50K /export/home/moore</tt> </pre> <p>Note that <tt>tank/home</tt> is using 5 Gbytes of space, although the total amount of space referred to by <tt>tank/home</tt> and its descendents is much less than 5 Gbytes. The used space reflects the space reserved for <tt>tank/home/moore</tt>. Reservations are considered in the used space of the parent dataset and do count against its quota, reservation, or both.</p> <pre> <tt># <tt>zfs set quota=5G pool/filesystem</tt> # <tt>zfs set reservation=10G pool/filesystem/user1</tt> cannot set reservation for 'pool/filesystem/user1': size is greater than available space</tt> </pre> <p>A dataset can use more space than its reservation, as long as space is available in the pool that is unreserved and the dataset's current usage is below its quota. A dataset cannot consume space that has been reserved for another dataset.</p> <p>Reservations are not cumulative. That is, a second invocation of <tt>zfs set</tt> to set a reservation does not add its reservation to the existing reservation. Rather, the second reservation replaces the first reservation.</p> <pre> <tt># <tt>zfs set reservation=10G tank/home/moore</tt> # <tt>zfs set reservation=5G tank/home/moore</tt> # <tt>zfs get reservation tank/home/moore</tt> NAME PROPERTY VALUE SOURCE tank/home/moore reservation 5.00G local</tt> </pre> <p>You can set a <tt>refreservation</tt> to guarantee space for a dataset that does not include space consumed by snapshots and clones. The <tt>refreservation</tt> reservation is accounted for in the parent datasets' space used, and counts against the parent datasets' quotas and reservations. For example:</p> <pre> <tt># <tt>zfs set refreservation=10g profs/prof1</tt> # <tt>zfs list</tt> NAME USED AVAIL REFER MOUNTPOINT profs 10.0G 23.2G 19K /profs profs/prof1 10G 33.2G 18K /profs/prof1</tt> </pre> <p>You can also set a reservation on the same dataset to guarantee dataset space and snapshot space. For example:</p> <pre> <tt># <tt>zfs set reservation=20g profs/prof1</tt> # <tt>zfs list</tt> NAME USED AVAIL REFER MOUNTPOINT profs 20.0G 13.2G 19K /profs profs/prof1 10G 33.2G 18K /profs/prof1</tt> </pre> <p>Regular reservations are accounted for in the parent's used space.</p> <p>In the above example, the smaller of the two quotas (10 Gbytes versus 20 Gbytes) is displayed in the <tt>zfs list</tt> output. To see the value of both quotas, use the <tt>zfs get</tt> command. For example:</p> <pre> <tt># <tt>zfs get reservation,refreserv profs/prof1</tt> NAME PROPERTY VALUE SOURCE profs/prof1 reservation 20G local profs/prof1 refreservation 10G local</tt> </pre> <p>If <tt>refreservation</tt> is set, a snapshot is only allowed if enough free pool space exists outside of this reservation to accommodate the current number of <b>referenced</b> bytes in the dataset.</p> </div> </td> </tr> <tr valign="top" class="PageControls"> <td></td><td> <table width="100%"> <tr> <td align="left"><a href="chapter4.html">Previous</a></td><td align="right"><a href="chapter6.html">Next</a></td> </tr> </table> </td> </tr> </tbody> </table> </body> </html> |
| INFO: Archive path is /tiers/communitytools/TS/archive/ <br> INFO:zipFilePathInArchive is: /tiers/communitytools/TS/archive/solbookgraphics_76job number = 76 <br> INFO:zipFilePathInArchive is: /tiers/communitytools/TS/archive/solbookgraphics_76 <br> Book File is :/tiers/communitytools/TS/archive/solbookgraphics_76/ZFSADMIN/ZFSADMIN.book <br> Successfully completed XSLT transform <br> Status: Given Doc is transformed Successfully <br> Output path: /tiers/communitytools/TS/archive/solbookgraphics_76/transform <br> |