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