xref: /freebsd/sys/contrib/openzfs/man/man8/zfs.8 (revision cb2887746f8b9dd4ad6b1e757cdc053a08b25a2e)
1.\" SPDX-License-Identifier: CDDL-1.0
2.\"
3.\" CDDL HEADER START
4.\"
5.\" The contents of this file are subject to the terms of the
6.\" Common Development and Distribution License (the "License").
7.\" You may not use this file except in compliance with the License.
8.\"
9.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10.\" or https://opensource.org/licenses/CDDL-1.0.
11.\" See the License for the specific language governing permissions
12.\" and limitations under the License.
13.\"
14.\" When distributing Covered Code, include this CDDL HEADER in each
15.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16.\" If applicable, add the following below this CDDL HEADER, with the
17.\" fields enclosed by brackets "[]" replaced with your own identifying
18.\" information: Portions Copyright [yyyy] [name of copyright owner]
19.\"
20.\" CDDL HEADER END
21.\"
22.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
23.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
24.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
25.\" Copyright (c) 2011, Pawel Jakub Dawidek <pjd@FreeBSD.org>
26.\" Copyright (c) 2012, Glen Barber <gjb@FreeBSD.org>
27.\" Copyright (c) 2012, Bryan Drewery <bdrewery@FreeBSD.org>
28.\" Copyright (c) 2013, Steven Hartland <smh@FreeBSD.org>
29.\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
30.\" Copyright (c) 2014, Joyent, Inc. All rights reserved.
31.\" Copyright (c) 2014 by Adam Stevko. All rights reserved.
32.\" Copyright (c) 2014 Integros [integros.com]
33.\" Copyright (c) 2014, Xin LI <delphij@FreeBSD.org>
34.\" Copyright (c) 2014-2015, The FreeBSD Foundation, All Rights Reserved.
35.\" Copyright (c) 2016 Nexenta Systems, Inc. All Rights Reserved.
36.\" Copyright 2019 Richard Laager. All rights reserved.
37.\" Copyright 2018 Nexenta Systems, Inc.
38.\" Copyright 2019 Joyent, Inc.
39.\"
40.Dd April 18, 2025
41.Dt ZFS 8
42.Os
43.
44.Sh NAME
45.Nm zfs
46.Nd configure ZFS datasets
47.Sh SYNOPSIS
48.Nm
49.Fl ?V
50.Nm
51.Cm version
52.Op Fl j
53.Nm
54.Cm subcommand
55.Op Ar arguments
56.
57.Sh DESCRIPTION
58The
59.Nm
60command configures ZFS datasets within a ZFS storage pool, as described in
61.Xr zpool 8 .
62A dataset is identified by a unique path within the ZFS namespace:
63.Pp
64.D1 Ar pool Ns Oo Sy / Ns Ar component Oc Ns Sy / Ns Ar component
65.Pp
66for example:
67.Pp
68.Dl rpool/var/log
69.Pp
70The maximum length of a dataset name is
71.Sy ZFS_MAX_DATASET_NAME_LEN No - 1
72ASCII characters (currently 255) satisfying
73.Sy [A-Za-z_.:/ -] .
74Additionally snapshots are allowed to contain a single
75.Sy @
76character, while bookmarks are allowed to contain a single
77.Sy #
78character.
79.Sy /
80is used as separator between components.
81The maximum amount of nesting allowed in a path is
82.Sy zfs_max_dataset_nesting
83levels deep.
84ZFS tunables
85.Pq Sy zfs_*
86are explained in
87.Xr zfs 4 .
88.Pp
89A dataset can be one of the following:
90.Bl -tag -offset Ds -width "file system"
91.It Sy file system
92Can be mounted within the standard system namespace and behaves like other file
93systems.
94While ZFS file systems are designed to be POSIX-compliant, known issues exist
95that prevent compliance in some cases.
96Applications that depend on standards conformance might fail due to non-standard
97behavior when checking file system free space.
98.It Sy volume
99A logical volume exported as a raw or block device.
100This type of dataset should only be used when a block device is required.
101File systems are typically used in most environments.
102.It Sy snapshot
103A read-only version of a file system or volume at a given point in time.
104It is specified as
105.Ar filesystem Ns @ Ns Ar name
106or
107.Ar volume Ns @ Ns Ar name .
108.It Sy bookmark
109Much like a
110.Sy snapshot ,
111but without the hold on on-disk data.
112It can be used as the source of a send (but not for a receive).
113It is specified as
114.Ar filesystem Ns # Ns Ar name
115or
116.Ar volume Ns # Ns Ar name .
117.El
118.Pp
119See
120.Xr zfsconcepts 7
121for details.
122.
123.Ss Properties
124Properties are divided into two types: native properties and user-defined
125.Pq or Qq user
126properties.
127Native properties either export internal statistics or control ZFS behavior.
128In addition, native properties are either editable or read-only.
129User properties have no effect on ZFS behavior, but you can use them to annotate
130datasets in a way that is meaningful in your environment.
131For more information about properties, see
132.Xr zfsprops 7 .
133.
134.Ss Encryption
135Enabling the
136.Sy encryption
137feature allows for the creation of encrypted filesystems and volumes.
138ZFS will encrypt file and zvol data, file attributes, ACLs, permission bits,
139directory listings, FUID mappings, and
140.Sy userused Ns / Ns Sy groupused Ns / Ns Sy projectused
141data.
142For an overview of encryption, see
143.Xr zfs-load-key 8 .
144.
145.Sh SUBCOMMANDS
146All subcommands that modify state are logged persistently to the pool in their
147original form.
148.Bl -tag -width ""
149.It Nm Fl ?
150Displays a help message.
151.It Xo
152.Nm
153.Fl V , -version
154.Xc
155.It Xo
156.Nm
157.Cm version
158.Op Fl j
159.Xc
160Displays the software version of the
161.Nm
162userland utility and the zfs kernel module.
163Use
164.Fl j
165option to output in JSON format.
166.El
167.
168.Ss Dataset Management
169.Bl -tag -width ""
170.It Xr zfs-list 8
171Lists the property information for the given datasets in tabular form.
172.It Xr zfs-create 8
173Creates a new ZFS file system or volume.
174.It Xr zfs-destroy 8
175Destroys the given dataset(s), snapshot(s), or bookmark.
176.It Xr zfs-rename 8
177Renames the given dataset (filesystem or snapshot).
178.It Xr zfs-upgrade 8
179Manage upgrading the on-disk version of filesystems.
180.El
181.
182.Ss Snapshots
183.Bl -tag -width ""
184.It Xr zfs-snapshot 8
185Creates snapshots with the given names.
186.It Xr zfs-rollback 8
187Roll back the given dataset to a previous snapshot.
188.It Xr zfs-hold 8 Ns / Ns Xr zfs-release 8
189Add or remove a hold reference to the specified snapshot or snapshots.
190If a hold exists on a snapshot, attempts to destroy that snapshot by using the
191.Nm zfs Cm destroy
192command return
193.Sy EBUSY .
194.It Xr zfs-diff 8
195Display the difference between a snapshot of a given filesystem and another
196snapshot of that filesystem from a later time or the current contents of the
197filesystem.
198.El
199.
200.Ss Clones
201.Bl -tag -width ""
202.It Xr zfs-clone 8
203Creates a clone of the given snapshot.
204.It Xr zfs-promote 8
205Promotes a clone file system to no longer be dependent on its
206.Qq origin
207snapshot.
208.El
209.
210.Ss Send & Receive
211.Bl -tag -width ""
212.It Xr zfs-send 8
213Generate a send stream, which may be of a filesystem, and may be incremental
214from a bookmark.
215.It Xr zfs-receive 8
216Creates a snapshot whose contents are as specified in the stream provided on
217standard input.
218If a full stream is received, then a new file system is created as well.
219Streams are created using the
220.Xr zfs-send 8
221subcommand, which by default creates a full stream.
222.It Xr zfs-bookmark 8
223Creates a new bookmark of the given snapshot or bookmark.
224Bookmarks mark the point in time when the snapshot was created, and can be used
225as the incremental source for a
226.Nm zfs Cm send
227command.
228.It Xr zfs-redact 8
229Generate a new redaction bookmark.
230This feature can be used to allow clones of a filesystem to be made available on
231a remote system, in the case where their parent need not (or needs to not) be
232usable.
233.El
234.
235.Ss Properties
236.Bl -tag -width ""
237.It Xr zfs-get 8
238Displays properties for the given datasets.
239.It Xr zfs-set 8
240Sets the property or list of properties to the given value(s) for each dataset.
241.It Xr zfs-inherit 8
242Clears the specified property, causing it to be inherited from an ancestor,
243restored to default if no ancestor has the property set, or with the
244.Fl S
245option reverted to the received value if one exists.
246.El
247.
248.Ss Quotas
249.Bl -tag -width ""
250.It Xr zfs-userspace 8 Ns / Ns Xr zfs-groupspace 8 Ns / Ns Xr zfs-projectspace 8
251Displays space consumed by, and quotas on, each user, group, or project
252in the specified filesystem or snapshot.
253.It Xr zfs-project 8
254List, set, or clear project ID and/or inherit flag on the files or directories.
255.El
256.
257.Ss Mountpoints
258.Bl -tag -width ""
259.It Xr zfs-mount 8
260Displays all ZFS file systems currently mounted, or mount ZFS filesystem
261on a path described by its
262.Sy mountpoint
263property.
264.It Xr zfs-unmount 8
265Unmounts currently mounted ZFS file systems.
266.El
267.
268.Ss Shares
269.Bl -tag -width ""
270.It Xr zfs-share 8
271Shares available ZFS file systems.
272.It Xr zfs-unshare 8
273Unshares currently shared ZFS file systems.
274.El
275.
276.Ss Delegated Administration
277.Bl -tag -width ""
278.It Xr zfs-allow 8
279Delegate permissions on the specified filesystem or volume.
280.It Xr zfs-unallow 8
281Remove delegated permissions on the specified filesystem or volume.
282.El
283.
284.Ss Encryption
285.Bl -tag -width ""
286.It Xr zfs-change-key 8
287Add or change an encryption key on the specified dataset.
288.It Xr zfs-load-key 8
289Load the key for the specified encrypted dataset, enabling access.
290.It Xr zfs-unload-key 8
291Unload a key for the specified dataset,
292removing the ability to access the dataset.
293.El
294.
295.Ss Channel Programs
296.Bl -tag -width ""
297.It Xr zfs-program 8
298Execute ZFS administrative operations
299programmatically via a Lua script-language channel program.
300.El
301.
302.Ss Data rewrite
303.Bl -tag -width ""
304.It Xr zfs-rewrite 8
305Rewrite specified files without modification.
306.El
307.
308.Ss Jails
309.Bl -tag -width ""
310.It Xr zfs-jail 8
311Attaches a filesystem to a jail.
312.It Xr zfs-unjail 8
313Detaches a filesystem from a jail.
314.El
315.
316.Ss Waiting
317.Bl -tag -width ""
318.It Xr zfs-wait 8
319Wait for background activity in a filesystem to complete.
320.El
321.
322.Sh EXIT STATUS
323The
324.Nm
325utility exits
326.Sy 0
327on success,
328.Sy 1
329if an error occurs, and
330.Sy 2
331if invalid command line options were specified.
332.
333.Sh EXAMPLES
334.\" Examples 1, 4, 6, 7, 11, 14, 16 are shared with zfs-set.8.
335.\" Examples 1, 10 are shared with zfs-create.8.
336.\" Examples 2, 3, 10, 15 are also shared with zfs-snapshot.8.
337.\" Examples 3, 10, 15 are shared with zfs-destroy.8.
338.\" Examples 5 are shared with zfs-list.8.
339.\" Examples 8 are shared with zfs-rollback.8.
340.\" Examples 9, 10 are shared with zfs-clone.8.
341.\" Examples 10 are also shared with zfs-promote.8.
342.\" Examples 10, 15 also are shared with zfs-rename.8.
343.\" Examples 12, 13 are shared with zfs-send.8.
344.\" Examples 12, 13 are also shared with zfs-receive.8.
345.\" Examples 17, 18, 19, 20, 21 are shared with zfs-allow.8.
346.\" Examples 22 are shared with zfs-diff.8.
347.\" Examples 23 are shared with zfs-bookmark.8.
348.\" Make sure to update them omnidirectionally
349.Ss Example 1 : No Creating a ZFS File System Hierarchy
350The following commands create a file system named
351.Ar pool/home
352and a file system named
353.Ar pool/home/bob .
354The mount point
355.Pa /export/home
356is set for the parent file system, and is automatically inherited by the child
357file system.
358.Dl # Nm zfs Cm create Ar pool/home
359.Dl # Nm zfs Cm set Sy mountpoint Ns = Ns Ar /export/home pool/home
360.Dl # Nm zfs Cm create Ar pool/home/bob
361.
362.Ss Example 2 : No Creating a ZFS Snapshot
363The following command creates a snapshot named
364.Ar yesterday .
365This snapshot is mounted on demand in the
366.Pa .zfs/snapshot
367directory at the root of the
368.Ar pool/home/bob
369file system.
370.Dl # Nm zfs Cm snapshot Ar pool/home/bob Ns @ Ns Ar yesterday
371.
372.Ss Example 3 : No Creating and Destroying Multiple Snapshots
373The following command creates snapshots named
374.Ar yesterday No of Ar pool/home
375and all of its descendent file systems.
376Each snapshot is mounted on demand in the
377.Pa .zfs/snapshot
378directory at the root of its file system.
379The second command destroys the newly created snapshots.
380.Dl # Nm zfs Cm snapshot Fl r Ar pool/home Ns @ Ns Ar yesterday
381.Dl # Nm zfs Cm destroy Fl r Ar pool/home Ns @ Ns Ar yesterday
382.
383.Ss Example 4 : No Disabling and Enabling File System Compression
384The following command disables the
385.Sy compression
386property for all file systems under
387.Ar pool/home .
388The next command explicitly enables
389.Sy compression
390for
391.Ar pool/home/anne .
392.Dl # Nm zfs Cm set Sy compression Ns = Ns Sy off Ar pool/home
393.Dl # Nm zfs Cm set Sy compression Ns = Ns Sy on Ar pool/home/anne
394.
395.Ss Example 5 : No Listing ZFS Datasets
396The following command lists all active file systems and volumes in the system.
397Snapshots are displayed if
398.Sy listsnaps Ns = Ns Sy on .
399The default is
400.Sy off .
401See
402.Xr zpoolprops 7
403for more information on pool properties.
404.Bd -literal -compact -offset Ds
405.No # Nm zfs Cm list
406NAME                      USED  AVAIL  REFER  MOUNTPOINT
407pool                      450K   457G    18K  /pool
408pool/home                 315K   457G    21K  /export/home
409pool/home/anne             18K   457G    18K  /export/home/anne
410pool/home/bob             276K   457G   276K  /export/home/bob
411.Ed
412.
413.Ss Example 6 : No Setting a Quota on a ZFS File System
414The following command sets a quota of 50 Gbytes for
415.Ar pool/home/bob :
416.Dl # Nm zfs Cm set Sy quota Ns = Ns Ar 50G pool/home/bob
417.
418.Ss Example 7 : No Listing ZFS Properties
419The following command lists all properties for
420.Ar pool/home/bob :
421.Bd -literal -compact -offset Ds
422.No # Nm zfs Cm get Sy all Ar pool/home/bob
423NAME           PROPERTY              VALUE                  SOURCE
424pool/home/bob  type                  filesystem             -
425pool/home/bob  creation              Tue Jul 21 15:53 2009  -
426pool/home/bob  used                  21K                    -
427pool/home/bob  available             20.0G                  -
428pool/home/bob  referenced            21K                    -
429pool/home/bob  compressratio         1.00x                  -
430pool/home/bob  mounted               yes                    -
431pool/home/bob  quota                 20G                    local
432pool/home/bob  reservation           none                   default
433pool/home/bob  recordsize            128K                   default
434pool/home/bob  mountpoint            /pool/home/bob         default
435pool/home/bob  sharenfs              off                    default
436pool/home/bob  checksum              on                     default
437pool/home/bob  compression           on                     local
438pool/home/bob  atime                 on                     default
439pool/home/bob  devices               on                     default
440pool/home/bob  exec                  on                     default
441pool/home/bob  setuid                on                     default
442pool/home/bob  readonly              off                    default
443pool/home/bob  zoned                 off                    default
444pool/home/bob  snapdir               hidden                 default
445pool/home/bob  acltype               off                    default
446pool/home/bob  aclmode               discard                default
447pool/home/bob  aclinherit            restricted             default
448pool/home/bob  canmount              on                     default
449pool/home/bob  xattr                 on                     default
450pool/home/bob  copies                1                      default
451pool/home/bob  version               4                      -
452pool/home/bob  utf8only              off                    -
453pool/home/bob  normalization         none                   -
454pool/home/bob  casesensitivity       sensitive              -
455pool/home/bob  vscan                 off                    default
456pool/home/bob  nbmand                off                    default
457pool/home/bob  sharesmb              off                    default
458pool/home/bob  refquota              none                   default
459pool/home/bob  refreservation        none                   default
460pool/home/bob  primarycache          all                    default
461pool/home/bob  secondarycache        all                    default
462pool/home/bob  usedbysnapshots       0                      -
463pool/home/bob  usedbydataset         21K                    -
464pool/home/bob  usedbychildren        0                      -
465pool/home/bob  usedbyrefreservation  0                      -
466.Ed
467.Pp
468The following command gets a single property value:
469.Bd -literal -compact -offset Ds
470.No # Nm zfs Cm get Fl H o Sy value compression Ar pool/home/bob
471on
472.Ed
473.Pp
474The following command lists all properties with local settings for
475.Ar pool/home/bob :
476.Bd -literal -compact -offset Ds
477.No # Nm zfs Cm get Fl r s Sy local Fl o Sy name , Ns Sy property , Ns Sy value all Ar pool/home/bob
478NAME           PROPERTY              VALUE
479pool/home/bob  quota                 20G
480pool/home/bob  compression           on
481.Ed
482.
483.Ss Example 8 : No Rolling Back a ZFS File System
484The following command reverts the contents of
485.Ar pool/home/anne
486to the snapshot named
487.Ar yesterday ,
488deleting all intermediate snapshots:
489.Dl # Nm zfs Cm rollback Fl r Ar pool/home/anne Ns @ Ns Ar yesterday
490.
491.Ss Example 9 : No Creating a ZFS Clone
492The following command creates a writable file system whose initial contents are
493the same as
494.Ar pool/home/bob@yesterday .
495.Dl # Nm zfs Cm clone Ar pool/home/bob@yesterday pool/clone
496.
497.Ss Example 10 : No Promoting a ZFS Clone
498The following commands illustrate how to test out changes to a file system, and
499then replace the original file system with the changed one, using clones, clone
500promotion, and renaming:
501.Bd -literal -compact -offset Ds
502.No # Nm zfs Cm create Ar pool/project/production
503  populate /pool/project/production with data
504.No # Nm zfs Cm snapshot Ar pool/project/production Ns @ Ns Ar today
505.No # Nm zfs Cm clone Ar pool/project/production@today pool/project/beta
506  make changes to /pool/project/beta and test them
507.No # Nm zfs Cm promote Ar pool/project/beta
508.No # Nm zfs Cm rename Ar pool/project/production pool/project/legacy
509.No # Nm zfs Cm rename Ar pool/project/beta pool/project/production
510  once the legacy version is no longer needed, it can be destroyed
511.No # Nm zfs Cm destroy Ar pool/project/legacy
512.Ed
513.
514.Ss Example 11 : No Inheriting ZFS Properties
515The following command causes
516.Ar pool/home/bob No and Ar pool/home/anne
517to inherit the
518.Sy checksum
519property from their parent.
520.Dl # Nm zfs Cm inherit Sy checksum Ar pool/home/bob pool/home/anne
521.
522.Ss Example 12 : No Remotely Replicating ZFS Data
523The following commands send a full stream and then an incremental stream to a
524remote machine, restoring them into
525.Em poolB/received/fs@a
526and
527.Em poolB/received/fs@b ,
528respectively.
529.Em poolB
530must contain the file system
531.Em poolB/received ,
532and must not initially contain
533.Em poolB/received/fs .
534.Bd -literal -compact -offset Ds
535.No # Nm zfs Cm send Ar pool/fs@a |
536.No "   " Nm ssh Ar host Nm zfs Cm receive Ar poolB/received/fs Ns @ Ns Ar a
537.No # Nm zfs Cm send Fl i Ar a pool/fs@b |
538.No "   " Nm ssh Ar host Nm zfs Cm receive Ar poolB/received/fs
539.Ed
540.
541.Ss Example 13 : No Using the Nm zfs Cm receive Fl d No Option
542The following command sends a full stream of
543.Ar poolA/fsA/fsB@snap
544to a remote machine, receiving it into
545.Ar poolB/received/fsA/fsB@snap .
546The
547.Ar fsA/fsB@snap
548portion of the received snapshot's name is determined from the name of the sent
549snapshot.
550.Ar poolB
551must contain the file system
552.Ar poolB/received .
553If
554.Ar poolB/received/fsA
555does not exist, it is created as an empty file system.
556.Bd -literal -compact -offset Ds
557.No # Nm zfs Cm send Ar poolA/fsA/fsB@snap |
558.No "   " Nm ssh Ar host Nm zfs Cm receive Fl d Ar poolB/received
559.Ed
560.
561.Ss Example 14 : No Setting User Properties
562The following example sets the user-defined
563.Ar com.example : Ns Ar department
564property for a dataset:
565.Dl # Nm zfs Cm set Ar com.example : Ns Ar department Ns = Ns Ar 12345 tank/accounting
566.
567.Ss Example 15 : No Performing a Rolling Snapshot
568The following example shows how to maintain a history of snapshots with a
569consistent naming scheme.
570To keep a week's worth of snapshots, the user destroys the oldest snapshot,
571renames the remaining snapshots, and then creates a new snapshot, as follows:
572.Bd -literal -compact -offset Ds
573.No # Nm zfs Cm destroy Fl r Ar pool/users@7daysago
574.No # Nm zfs Cm rename Fl r Ar pool/users@6daysago No @ Ns Ar 7daysago
575.No # Nm zfs Cm rename Fl r Ar pool/users@5daysago No @ Ns Ar 6daysago
576.No # Nm zfs Cm rename Fl r Ar pool/users@4daysago No @ Ns Ar 5daysago
577.No # Nm zfs Cm rename Fl r Ar pool/users@3daysago No @ Ns Ar 4daysago
578.No # Nm zfs Cm rename Fl r Ar pool/users@2daysago No @ Ns Ar 3daysago
579.No # Nm zfs Cm rename Fl r Ar pool/users@yesterday No @ Ns Ar 2daysago
580.No # Nm zfs Cm rename Fl r Ar pool/users@today No @ Ns Ar yesterday
581.No # Nm zfs Cm snapshot Fl r Ar pool/users Ns @ Ns Ar today
582.Ed
583.
584.Ss Example 16 : No Setting sharenfs Property Options on a ZFS File System
585The following commands show how to set
586.Sy sharenfs
587property options to enable read-write
588access for a set of IP addresses and to enable root access for system
589.Qq neo
590on the
591.Ar tank/home
592file system:
593.Dl # Nm zfs Cm set Sy sharenfs Ns = Ns ' Ns Ar rw Ns =@123.123.0.0/16:[::1],root= Ns Ar neo Ns ' tank/home
594.Pp
595If you are using DNS for host name resolution,
596specify the fully-qualified hostname.
597.
598.Ss Example 17 : No Delegating ZFS Administration Permissions on a ZFS Dataset
599The following example shows how to set permissions so that user
600.Ar cindys
601can create, destroy, mount, and take snapshots on
602.Ar tank/cindys .
603The permissions on
604.Ar tank/cindys
605are also displayed.
606.Bd -literal -compact -offset Ds
607.No # Nm zfs Cm allow Sy cindys create , Ns Sy destroy , Ns Sy mount , Ns Sy snapshot Ar tank/cindys
608.No # Nm zfs Cm allow Ar tank/cindys
609---- Permissions on tank/cindys --------------------------------------
610Local+Descendent permissions:
611        user cindys create,destroy,mount,snapshot
612.Ed
613.Pp
614Because the
615.Ar tank/cindys
616mount point permission is set to 755 by default, user
617.Ar cindys
618will be unable to mount file systems under
619.Ar tank/cindys .
620Add an ACE similar to the following syntax to provide mount point access:
621.Dl # Cm chmod No A+user : Ns Ar cindys Ns :add_subdirectory:allow Ar /tank/cindys
622.
623.Ss Example 18 : No Delegating Create Time Permissions on a ZFS Dataset
624The following example shows how to grant anyone in the group
625.Ar staff
626to create file systems in
627.Ar tank/users .
628This syntax also allows staff members to destroy their own file systems, but not
629destroy anyone else's file system.
630The permissions on
631.Ar tank/users
632are also displayed.
633.Bd -literal -compact -offset Ds
634.No # Nm zfs Cm allow Ar staff Sy create , Ns Sy mount Ar tank/users
635.No # Nm zfs Cm allow Fl c Sy destroy Ar tank/users
636.No # Nm zfs Cm allow Ar tank/users
637---- Permissions on tank/users ---------------------------------------
638Permission sets:
639        destroy
640Local+Descendent permissions:
641        group staff create,mount
642.Ed
643.
644.Ss Example 19 : No Defining and Granting a Permission Set on a ZFS Dataset
645The following example shows how to define and grant a permission set on the
646.Ar tank/users
647file system.
648The permissions on
649.Ar tank/users
650are also displayed.
651.Bd -literal -compact -offset Ds
652.No # Nm zfs Cm allow Fl s No @ Ns Ar pset Sy create , Ns Sy destroy , Ns Sy snapshot , Ns Sy mount Ar tank/users
653.No # Nm zfs Cm allow staff No @ Ns Ar pset tank/users
654.No # Nm zfs Cm allow Ar tank/users
655---- Permissions on tank/users ---------------------------------------
656Permission sets:
657        @pset create,destroy,mount,snapshot
658Local+Descendent permissions:
659        group staff @pset
660.Ed
661.
662.Ss Example 20 : No Delegating Property Permissions on a ZFS Dataset
663The following example shows to grant the ability to set quotas and reservations
664on the
665.Ar users/home
666file system.
667The permissions on
668.Ar users/home
669are also displayed.
670.Bd -literal -compact -offset Ds
671.No # Nm zfs Cm allow Ar cindys Sy quota , Ns Sy reservation Ar users/home
672.No # Nm zfs Cm allow Ar users/home
673---- Permissions on users/home ---------------------------------------
674Local+Descendent permissions:
675        user cindys quota,reservation
676cindys% zfs set quota=10G users/home/marks
677cindys% zfs get quota users/home/marks
678NAME              PROPERTY  VALUE  SOURCE
679users/home/marks  quota     10G    local
680.Ed
681.
682.Ss Example 21 : No Removing ZFS Delegated Permissions on a ZFS Dataset
683The following example shows how to remove the snapshot permission from the
684.Ar staff
685group on the
686.Sy tank/users
687file system.
688The permissions on
689.Sy tank/users
690are also displayed.
691.Bd -literal -compact -offset Ds
692.No # Nm zfs Cm unallow Ar staff Sy snapshot Ar tank/users
693.No # Nm zfs Cm allow Ar tank/users
694---- Permissions on tank/users ---------------------------------------
695Permission sets:
696        @pset create,destroy,mount,snapshot
697Local+Descendent permissions:
698        group staff @pset
699.Ed
700.
701.Ss Example 22 : No Showing the differences between a snapshot and a ZFS Dataset
702The following example shows how to see what has changed between a prior
703snapshot of a ZFS dataset and its current state.
704The
705.Fl F
706option is used to indicate type information for the files affected.
707.Bd -literal -compact -offset Ds
708.No # Nm zfs Cm diff Fl F Ar tank/test@before tank/test
709M       /       /tank/test/
710M       F       /tank/test/linked      (+1)
711R       F       /tank/test/oldname -> /tank/test/newname
712-       F       /tank/test/deleted
713+       F       /tank/test/created
714M       F       /tank/test/modified
715.Ed
716.
717.Ss Example 23 : No Creating a bookmark
718The following example creates a bookmark to a snapshot.
719This bookmark can then be used instead of a snapshot in send streams.
720.Dl # Nm zfs Cm bookmark Ar rpool Ns @ Ns Ar snapshot rpool Ns # Ns Ar bookmark
721.
722.Ss Example 24 : No Setting Sy sharesmb No Property Options on a ZFS File System
723The following example show how to share SMB filesystem through ZFS.
724Note that a user and their password must be given.
725.Dl # Nm smbmount Ar //127.0.0.1/share_tmp /mnt/tmp Fl o No user=workgroup/turbo,password=obrut,uid=1000
726.Pp
727Minimal
728.Pa /etc/samba/smb.conf
729configuration is required, as follows.
730.Pp
731Samba will need to bind to the loopback interface for the ZFS utilities to
732communicate with Samba.
733This is the default behavior for most Linux distributions.
734.Pp
735Samba must be able to authenticate a user.
736This can be done in a number of ways
737.Pq Xr passwd 5 , LDAP , Xr smbpasswd 5 , &c.\& .
738How to do this is outside the scope of this document – refer to
739.Xr smb.conf 5
740for more information.
741.Pp
742See the
743.Sx USERSHARES
744section for all configuration options,
745in case you need to modify any options of the share afterwards.
746Do note that any changes done with the
747.Xr net 8
748command will be undone if the share is ever unshared (like via a reboot).
749.
750.Sh ENVIRONMENT VARIABLES
751.Bl -tag -width "ZFS_MODULE_TIMEOUT"
752.It Sy ZFS_COLOR
753Use ANSI color in
754.Nm zfs Cm diff
755and
756.Nm zfs Cm list
757output.
758.It Sy ZFS_MOUNT_HELPER
759Cause
760.Nm zfs Cm mount
761to use
762.Xr mount 8
763to mount ZFS datasets.
764This option is provided for backwards compatibility with older ZFS versions.
765.
766.It Sy ZFS_SET_PIPE_MAX
767Tells
768.Nm zfs
769to set the maximum pipe size for sends/receives.
770Disabled by default on Linux
771due to an unfixed deadlock in Linux's pipe size handling code.
772.
773.\" Shared with zpool.8
774.It Sy ZFS_MODULE_TIMEOUT
775Time, in seconds, to wait for
776.Pa /dev/zfs
777to appear.
778Defaults to
779.Sy 10 ,
780max
781.Sy 600 Pq 10 minutes .
782If
783.Pf < Sy 0 ,
784wait forever; if
785.Sy 0 ,
786don't wait.
787.El
788.
789.Sh INTERFACE STABILITY
790.Sy Committed .
791.
792.Sh SEE ALSO
793.Xr attr 1 ,
794.Xr gzip 1 ,
795.Xr ssh 1 ,
796.Xr chmod 2 ,
797.Xr fsync 2 ,
798.Xr stat 2 ,
799.Xr write 2 ,
800.Xr acl 5 ,
801.Xr attributes 5 ,
802.Xr exports 5 ,
803.Xr zfsconcepts 7 ,
804.Xr zfsprops 7 ,
805.Xr exportfs 8 ,
806.Xr mount 8 ,
807.Xr net 8 ,
808.Xr selinux 8 ,
809.Xr zfs-allow 8 ,
810.Xr zfs-bookmark 8 ,
811.Xr zfs-change-key 8 ,
812.Xr zfs-clone 8 ,
813.Xr zfs-create 8 ,
814.Xr zfs-destroy 8 ,
815.Xr zfs-diff 8 ,
816.Xr zfs-get 8 ,
817.Xr zfs-groupspace 8 ,
818.Xr zfs-hold 8 ,
819.Xr zfs-inherit 8 ,
820.Xr zfs-jail 8 ,
821.Xr zfs-list 8 ,
822.Xr zfs-load-key 8 ,
823.Xr zfs-mount 8 ,
824.Xr zfs-program 8 ,
825.Xr zfs-project 8 ,
826.Xr zfs-projectspace 8 ,
827.Xr zfs-promote 8 ,
828.Xr zfs-receive 8 ,
829.Xr zfs-redact 8 ,
830.Xr zfs-release 8 ,
831.Xr zfs-rename 8 ,
832.Xr zfs-rollback 8 ,
833.Xr zfs-send 8 ,
834.Xr zfs-set 8 ,
835.Xr zfs-share 8 ,
836.Xr zfs-snapshot 8 ,
837.Xr zfs-unallow 8 ,
838.Xr zfs-unjail 8 ,
839.Xr zfs-unload-key 8 ,
840.Xr zfs-unmount 8 ,
841.Xr zfs-unshare 8 ,
842.Xr zfs-upgrade 8 ,
843.Xr zfs-userspace 8 ,
844.Xr zfs-wait 8 ,
845.Xr zpool 8
846