xref: /freebsd/sys/contrib/openzfs/man/man8/zfs.8 (revision 61145dc2b94f12f6a47344fb9aac702321880e43)
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 May 12, 2022
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 Jails
303.Bl -tag -width ""
304.It Xr zfs-jail 8
305Attaches a filesystem to a jail.
306.It Xr zfs-unjail 8
307Detaches a filesystem from a jail.
308.El
309.
310.Ss Waiting
311.Bl -tag -width ""
312.It Xr zfs-wait 8
313Wait for background activity in a filesystem to complete.
314.El
315.
316.Sh EXIT STATUS
317The
318.Nm
319utility exits
320.Sy 0
321on success,
322.Sy 1
323if an error occurs, and
324.Sy 2
325if invalid command line options were specified.
326.
327.Sh EXAMPLES
328.\" Examples 1, 4, 6, 7, 11, 14, 16 are shared with zfs-set.8.
329.\" Examples 1, 10 are shared with zfs-create.8.
330.\" Examples 2, 3, 10, 15 are also shared with zfs-snapshot.8.
331.\" Examples 3, 10, 15 are shared with zfs-destroy.8.
332.\" Examples 5 are shared with zfs-list.8.
333.\" Examples 8 are shared with zfs-rollback.8.
334.\" Examples 9, 10 are shared with zfs-clone.8.
335.\" Examples 10 are also shared with zfs-promote.8.
336.\" Examples 10, 15 also are shared with zfs-rename.8.
337.\" Examples 12, 13 are shared with zfs-send.8.
338.\" Examples 12, 13 are also shared with zfs-receive.8.
339.\" Examples 17, 18, 19, 20, 21 are shared with zfs-allow.8.
340.\" Examples 22 are shared with zfs-diff.8.
341.\" Examples 23 are shared with zfs-bookmark.8.
342.\" Make sure to update them omnidirectionally
343.Ss Example 1 : No Creating a ZFS File System Hierarchy
344The following commands create a file system named
345.Ar pool/home
346and a file system named
347.Ar pool/home/bob .
348The mount point
349.Pa /export/home
350is set for the parent file system, and is automatically inherited by the child
351file system.
352.Dl # Nm zfs Cm create Ar pool/home
353.Dl # Nm zfs Cm set Sy mountpoint Ns = Ns Ar /export/home pool/home
354.Dl # Nm zfs Cm create Ar pool/home/bob
355.
356.Ss Example 2 : No Creating a ZFS Snapshot
357The following command creates a snapshot named
358.Ar yesterday .
359This snapshot is mounted on demand in the
360.Pa .zfs/snapshot
361directory at the root of the
362.Ar pool/home/bob
363file system.
364.Dl # Nm zfs Cm snapshot Ar pool/home/bob Ns @ Ns Ar yesterday
365.
366.Ss Example 3 : No Creating and Destroying Multiple Snapshots
367The following command creates snapshots named
368.Ar yesterday No of Ar pool/home
369and all of its descendent file systems.
370Each snapshot is mounted on demand in the
371.Pa .zfs/snapshot
372directory at the root of its file system.
373The second command destroys the newly created snapshots.
374.Dl # Nm zfs Cm snapshot Fl r Ar pool/home Ns @ Ns Ar yesterday
375.Dl # Nm zfs Cm destroy Fl r Ar pool/home Ns @ Ns Ar yesterday
376.
377.Ss Example 4 : No Disabling and Enabling File System Compression
378The following command disables the
379.Sy compression
380property for all file systems under
381.Ar pool/home .
382The next command explicitly enables
383.Sy compression
384for
385.Ar pool/home/anne .
386.Dl # Nm zfs Cm set Sy compression Ns = Ns Sy off Ar pool/home
387.Dl # Nm zfs Cm set Sy compression Ns = Ns Sy on Ar pool/home/anne
388.
389.Ss Example 5 : No Listing ZFS Datasets
390The following command lists all active file systems and volumes in the system.
391Snapshots are displayed if
392.Sy listsnaps Ns = Ns Sy on .
393The default is
394.Sy off .
395See
396.Xr zpoolprops 7
397for more information on pool properties.
398.Bd -literal -compact -offset Ds
399.No # Nm zfs Cm list
400NAME                      USED  AVAIL  REFER  MOUNTPOINT
401pool                      450K   457G    18K  /pool
402pool/home                 315K   457G    21K  /export/home
403pool/home/anne             18K   457G    18K  /export/home/anne
404pool/home/bob             276K   457G   276K  /export/home/bob
405.Ed
406.
407.Ss Example 6 : No Setting a Quota on a ZFS File System
408The following command sets a quota of 50 Gbytes for
409.Ar pool/home/bob :
410.Dl # Nm zfs Cm set Sy quota Ns = Ns Ar 50G pool/home/bob
411.
412.Ss Example 7 : No Listing ZFS Properties
413The following command lists all properties for
414.Ar pool/home/bob :
415.Bd -literal -compact -offset Ds
416.No # Nm zfs Cm get Sy all Ar pool/home/bob
417NAME           PROPERTY              VALUE                  SOURCE
418pool/home/bob  type                  filesystem             -
419pool/home/bob  creation              Tue Jul 21 15:53 2009  -
420pool/home/bob  used                  21K                    -
421pool/home/bob  available             20.0G                  -
422pool/home/bob  referenced            21K                    -
423pool/home/bob  compressratio         1.00x                  -
424pool/home/bob  mounted               yes                    -
425pool/home/bob  quota                 20G                    local
426pool/home/bob  reservation           none                   default
427pool/home/bob  recordsize            128K                   default
428pool/home/bob  mountpoint            /pool/home/bob         default
429pool/home/bob  sharenfs              off                    default
430pool/home/bob  checksum              on                     default
431pool/home/bob  compression           on                     local
432pool/home/bob  atime                 on                     default
433pool/home/bob  devices               on                     default
434pool/home/bob  exec                  on                     default
435pool/home/bob  setuid                on                     default
436pool/home/bob  readonly              off                    default
437pool/home/bob  zoned                 off                    default
438pool/home/bob  snapdir               hidden                 default
439pool/home/bob  acltype               off                    default
440pool/home/bob  aclmode               discard                default
441pool/home/bob  aclinherit            restricted             default
442pool/home/bob  canmount              on                     default
443pool/home/bob  xattr                 on                     default
444pool/home/bob  copies                1                      default
445pool/home/bob  version               4                      -
446pool/home/bob  utf8only              off                    -
447pool/home/bob  normalization         none                   -
448pool/home/bob  casesensitivity       sensitive              -
449pool/home/bob  vscan                 off                    default
450pool/home/bob  nbmand                off                    default
451pool/home/bob  sharesmb              off                    default
452pool/home/bob  refquota              none                   default
453pool/home/bob  refreservation        none                   default
454pool/home/bob  primarycache          all                    default
455pool/home/bob  secondarycache        all                    default
456pool/home/bob  usedbysnapshots       0                      -
457pool/home/bob  usedbydataset         21K                    -
458pool/home/bob  usedbychildren        0                      -
459pool/home/bob  usedbyrefreservation  0                      -
460.Ed
461.Pp
462The following command gets a single property value:
463.Bd -literal -compact -offset Ds
464.No # Nm zfs Cm get Fl H o Sy value compression Ar pool/home/bob
465on
466.Ed
467.Pp
468The following command lists all properties with local settings for
469.Ar pool/home/bob :
470.Bd -literal -compact -offset Ds
471.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
472NAME           PROPERTY              VALUE
473pool/home/bob  quota                 20G
474pool/home/bob  compression           on
475.Ed
476.
477.Ss Example 8 : No Rolling Back a ZFS File System
478The following command reverts the contents of
479.Ar pool/home/anne
480to the snapshot named
481.Ar yesterday ,
482deleting all intermediate snapshots:
483.Dl # Nm zfs Cm rollback Fl r Ar pool/home/anne Ns @ Ns Ar yesterday
484.
485.Ss Example 9 : No Creating a ZFS Clone
486The following command creates a writable file system whose initial contents are
487the same as
488.Ar pool/home/bob@yesterday .
489.Dl # Nm zfs Cm clone Ar pool/home/bob@yesterday pool/clone
490.
491.Ss Example 10 : No Promoting a ZFS Clone
492The following commands illustrate how to test out changes to a file system, and
493then replace the original file system with the changed one, using clones, clone
494promotion, and renaming:
495.Bd -literal -compact -offset Ds
496.No # Nm zfs Cm create Ar pool/project/production
497  populate /pool/project/production with data
498.No # Nm zfs Cm snapshot Ar pool/project/production Ns @ Ns Ar today
499.No # Nm zfs Cm clone Ar pool/project/production@today pool/project/beta
500  make changes to /pool/project/beta and test them
501.No # Nm zfs Cm promote Ar pool/project/beta
502.No # Nm zfs Cm rename Ar pool/project/production pool/project/legacy
503.No # Nm zfs Cm rename Ar pool/project/beta pool/project/production
504  once the legacy version is no longer needed, it can be destroyed
505.No # Nm zfs Cm destroy Ar pool/project/legacy
506.Ed
507.
508.Ss Example 11 : No Inheriting ZFS Properties
509The following command causes
510.Ar pool/home/bob No and Ar pool/home/anne
511to inherit the
512.Sy checksum
513property from their parent.
514.Dl # Nm zfs Cm inherit Sy checksum Ar pool/home/bob pool/home/anne
515.
516.Ss Example 12 : No Remotely Replicating ZFS Data
517The following commands send a full stream and then an incremental stream to a
518remote machine, restoring them into
519.Em poolB/received/fs@a
520and
521.Em poolB/received/fs@b ,
522respectively.
523.Em poolB
524must contain the file system
525.Em poolB/received ,
526and must not initially contain
527.Em poolB/received/fs .
528.Bd -literal -compact -offset Ds
529.No # Nm zfs Cm send Ar pool/fs@a |
530.No "   " Nm ssh Ar host Nm zfs Cm receive Ar poolB/received/fs Ns @ Ns Ar a
531.No # Nm zfs Cm send Fl i Ar a pool/fs@b |
532.No "   " Nm ssh Ar host Nm zfs Cm receive Ar poolB/received/fs
533.Ed
534.
535.Ss Example 13 : No Using the Nm zfs Cm receive Fl d No Option
536The following command sends a full stream of
537.Ar poolA/fsA/fsB@snap
538to a remote machine, receiving it into
539.Ar poolB/received/fsA/fsB@snap .
540The
541.Ar fsA/fsB@snap
542portion of the received snapshot's name is determined from the name of the sent
543snapshot.
544.Ar poolB
545must contain the file system
546.Ar poolB/received .
547If
548.Ar poolB/received/fsA
549does not exist, it is created as an empty file system.
550.Bd -literal -compact -offset Ds
551.No # Nm zfs Cm send Ar poolA/fsA/fsB@snap |
552.No "   " Nm ssh Ar host Nm zfs Cm receive Fl d Ar poolB/received
553.Ed
554.
555.Ss Example 14 : No Setting User Properties
556The following example sets the user-defined
557.Ar com.example : Ns Ar department
558property for a dataset:
559.Dl # Nm zfs Cm set Ar com.example : Ns Ar department Ns = Ns Ar 12345 tank/accounting
560.
561.Ss Example 15 : No Performing a Rolling Snapshot
562The following example shows how to maintain a history of snapshots with a
563consistent naming scheme.
564To keep a week's worth of snapshots, the user destroys the oldest snapshot,
565renames the remaining snapshots, and then creates a new snapshot, as follows:
566.Bd -literal -compact -offset Ds
567.No # Nm zfs Cm destroy Fl r Ar pool/users@7daysago
568.No # Nm zfs Cm rename Fl r Ar pool/users@6daysago No @ Ns Ar 7daysago
569.No # Nm zfs Cm rename Fl r Ar pool/users@5daysago No @ Ns Ar 6daysago
570.No # Nm zfs Cm rename Fl r Ar pool/users@4daysago No @ Ns Ar 5daysago
571.No # Nm zfs Cm rename Fl r Ar pool/users@3daysago No @ Ns Ar 4daysago
572.No # Nm zfs Cm rename Fl r Ar pool/users@2daysago No @ Ns Ar 3daysago
573.No # Nm zfs Cm rename Fl r Ar pool/users@yesterday No @ Ns Ar 2daysago
574.No # Nm zfs Cm rename Fl r Ar pool/users@today No @ Ns Ar yesterday
575.No # Nm zfs Cm snapshot Fl r Ar pool/users Ns @ Ns Ar today
576.Ed
577.
578.Ss Example 16 : No Setting sharenfs Property Options on a ZFS File System
579The following commands show how to set
580.Sy sharenfs
581property options to enable read-write
582access for a set of IP addresses and to enable root access for system
583.Qq neo
584on the
585.Ar tank/home
586file system:
587.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
588.Pp
589If you are using DNS for host name resolution,
590specify the fully-qualified hostname.
591.
592.Ss Example 17 : No Delegating ZFS Administration Permissions on a ZFS Dataset
593The following example shows how to set permissions so that user
594.Ar cindys
595can create, destroy, mount, and take snapshots on
596.Ar tank/cindys .
597The permissions on
598.Ar tank/cindys
599are also displayed.
600.Bd -literal -compact -offset Ds
601.No # Nm zfs Cm allow Sy cindys create , Ns Sy destroy , Ns Sy mount , Ns Sy snapshot Ar tank/cindys
602.No # Nm zfs Cm allow Ar tank/cindys
603---- Permissions on tank/cindys --------------------------------------
604Local+Descendent permissions:
605        user cindys create,destroy,mount,snapshot
606.Ed
607.Pp
608Because the
609.Ar tank/cindys
610mount point permission is set to 755 by default, user
611.Ar cindys
612will be unable to mount file systems under
613.Ar tank/cindys .
614Add an ACE similar to the following syntax to provide mount point access:
615.Dl # Cm chmod No A+user : Ns Ar cindys Ns :add_subdirectory:allow Ar /tank/cindys
616.
617.Ss Example 18 : No Delegating Create Time Permissions on a ZFS Dataset
618The following example shows how to grant anyone in the group
619.Ar staff
620to create file systems in
621.Ar tank/users .
622This syntax also allows staff members to destroy their own file systems, but not
623destroy anyone else's file system.
624The permissions on
625.Ar tank/users
626are also displayed.
627.Bd -literal -compact -offset Ds
628.No # Nm zfs Cm allow Ar staff Sy create , Ns Sy mount Ar tank/users
629.No # Nm zfs Cm allow Fl c Sy destroy Ar tank/users
630.No # Nm zfs Cm allow Ar tank/users
631---- Permissions on tank/users ---------------------------------------
632Permission sets:
633        destroy
634Local+Descendent permissions:
635        group staff create,mount
636.Ed
637.
638.Ss Example 19 : No Defining and Granting a Permission Set on a ZFS Dataset
639The following example shows how to define and grant a permission set on the
640.Ar tank/users
641file system.
642The permissions on
643.Ar tank/users
644are also displayed.
645.Bd -literal -compact -offset Ds
646.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
647.No # Nm zfs Cm allow staff No @ Ns Ar pset tank/users
648.No # Nm zfs Cm allow Ar tank/users
649---- Permissions on tank/users ---------------------------------------
650Permission sets:
651        @pset create,destroy,mount,snapshot
652Local+Descendent permissions:
653        group staff @pset
654.Ed
655.
656.Ss Example 20 : No Delegating Property Permissions on a ZFS Dataset
657The following example shows to grant the ability to set quotas and reservations
658on the
659.Ar users/home
660file system.
661The permissions on
662.Ar users/home
663are also displayed.
664.Bd -literal -compact -offset Ds
665.No # Nm zfs Cm allow Ar cindys Sy quota , Ns Sy reservation Ar users/home
666.No # Nm zfs Cm allow Ar users/home
667---- Permissions on users/home ---------------------------------------
668Local+Descendent permissions:
669        user cindys quota,reservation
670cindys% zfs set quota=10G users/home/marks
671cindys% zfs get quota users/home/marks
672NAME              PROPERTY  VALUE  SOURCE
673users/home/marks  quota     10G    local
674.Ed
675.
676.Ss Example 21 : No Removing ZFS Delegated Permissions on a ZFS Dataset
677The following example shows how to remove the snapshot permission from the
678.Ar staff
679group on the
680.Sy tank/users
681file system.
682The permissions on
683.Sy tank/users
684are also displayed.
685.Bd -literal -compact -offset Ds
686.No # Nm zfs Cm unallow Ar staff Sy snapshot Ar tank/users
687.No # Nm zfs Cm allow Ar tank/users
688---- Permissions on tank/users ---------------------------------------
689Permission sets:
690        @pset create,destroy,mount,snapshot
691Local+Descendent permissions:
692        group staff @pset
693.Ed
694.
695.Ss Example 22 : No Showing the differences between a snapshot and a ZFS Dataset
696The following example shows how to see what has changed between a prior
697snapshot of a ZFS dataset and its current state.
698The
699.Fl F
700option is used to indicate type information for the files affected.
701.Bd -literal -compact -offset Ds
702.No # Nm zfs Cm diff Fl F Ar tank/test@before tank/test
703M       /       /tank/test/
704M       F       /tank/test/linked      (+1)
705R       F       /tank/test/oldname -> /tank/test/newname
706-       F       /tank/test/deleted
707+       F       /tank/test/created
708M       F       /tank/test/modified
709.Ed
710.
711.Ss Example 23 : No Creating a bookmark
712The following example creates a bookmark to a snapshot.
713This bookmark can then be used instead of a snapshot in send streams.
714.Dl # Nm zfs Cm bookmark Ar rpool Ns @ Ns Ar snapshot rpool Ns # Ns Ar bookmark
715.
716.Ss Example 24 : No Setting Sy sharesmb No Property Options on a ZFS File System
717The following example show how to share SMB filesystem through ZFS.
718Note that a user and their password must be given.
719.Dl # Nm smbmount Ar //127.0.0.1/share_tmp /mnt/tmp Fl o No user=workgroup/turbo,password=obrut,uid=1000
720.Pp
721Minimal
722.Pa /etc/samba/smb.conf
723configuration is required, as follows.
724.Pp
725Samba will need to bind to the loopback interface for the ZFS utilities to
726communicate with Samba.
727This is the default behavior for most Linux distributions.
728.Pp
729Samba must be able to authenticate a user.
730This can be done in a number of ways
731.Pq Xr passwd 5 , LDAP , Xr smbpasswd 5 , &c.\& .
732How to do this is outside the scope of this document – refer to
733.Xr smb.conf 5
734for more information.
735.Pp
736See the
737.Sx USERSHARES
738section for all configuration options,
739in case you need to modify any options of the share afterwards.
740Do note that any changes done with the
741.Xr net 8
742command will be undone if the share is ever unshared (like via a reboot).
743.
744.Sh ENVIRONMENT VARIABLES
745.Bl -tag -width "ZFS_MODULE_TIMEOUT"
746.It Sy ZFS_COLOR
747Use ANSI color in
748.Nm zfs Cm diff
749and
750.Nm zfs Cm list
751output.
752.It Sy ZFS_MOUNT_HELPER
753Cause
754.Nm zfs Cm mount
755to use
756.Xr mount 8
757to mount ZFS datasets.
758This option is provided for backwards compatibility with older ZFS versions.
759.
760.It Sy ZFS_SET_PIPE_MAX
761Tells
762.Nm zfs
763to set the maximum pipe size for sends/receives.
764Disabled by default on Linux
765due to an unfixed deadlock in Linux's pipe size handling code.
766.
767.\" Shared with zpool.8
768.It Sy ZFS_MODULE_TIMEOUT
769Time, in seconds, to wait for
770.Pa /dev/zfs
771to appear.
772Defaults to
773.Sy 10 ,
774max
775.Sy 600 Pq 10 minutes .
776If
777.Pf < Sy 0 ,
778wait forever; if
779.Sy 0 ,
780don't wait.
781.El
782.
783.Sh INTERFACE STABILITY
784.Sy Committed .
785.
786.Sh SEE ALSO
787.Xr attr 1 ,
788.Xr gzip 1 ,
789.Xr ssh 1 ,
790.Xr chmod 2 ,
791.Xr fsync 2 ,
792.Xr stat 2 ,
793.Xr write 2 ,
794.Xr acl 5 ,
795.Xr attributes 5 ,
796.Xr exports 5 ,
797.Xr zfsconcepts 7 ,
798.Xr zfsprops 7 ,
799.Xr exportfs 8 ,
800.Xr mount 8 ,
801.Xr net 8 ,
802.Xr selinux 8 ,
803.Xr zfs-allow 8 ,
804.Xr zfs-bookmark 8 ,
805.Xr zfs-change-key 8 ,
806.Xr zfs-clone 8 ,
807.Xr zfs-create 8 ,
808.Xr zfs-destroy 8 ,
809.Xr zfs-diff 8 ,
810.Xr zfs-get 8 ,
811.Xr zfs-groupspace 8 ,
812.Xr zfs-hold 8 ,
813.Xr zfs-inherit 8 ,
814.Xr zfs-jail 8 ,
815.Xr zfs-list 8 ,
816.Xr zfs-load-key 8 ,
817.Xr zfs-mount 8 ,
818.Xr zfs-program 8 ,
819.Xr zfs-project 8 ,
820.Xr zfs-projectspace 8 ,
821.Xr zfs-promote 8 ,
822.Xr zfs-receive 8 ,
823.Xr zfs-redact 8 ,
824.Xr zfs-release 8 ,
825.Xr zfs-rename 8 ,
826.Xr zfs-rollback 8 ,
827.Xr zfs-send 8 ,
828.Xr zfs-set 8 ,
829.Xr zfs-share 8 ,
830.Xr zfs-snapshot 8 ,
831.Xr zfs-unallow 8 ,
832.Xr zfs-unjail 8 ,
833.Xr zfs-unload-key 8 ,
834.Xr zfs-unmount 8 ,
835.Xr zfs-unshare 8 ,
836.Xr zfs-upgrade 8 ,
837.Xr zfs-userspace 8 ,
838.Xr zfs-wait 8 ,
839.Xr zpool 8
840