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.
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.
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]
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.
45 .Nd configures ZFS file systems
57 command configures ZFS datasets within a ZFS storage pool, as described in
59 A dataset is identified by a unique path within the ZFS namespace.
62 pool/{filesystem,volume,snapshot}
65 where the maximum length of a dataset name is
68 and the maximum amount of nesting allowed in a path is 50 levels deep.
70 A dataset can be one of the following:
71 .Bl -tag -width "file system"
75 can be mounted within the standard system namespace and behaves like other file
77 While ZFS file systems are designed to be POSIX compliant, known issues exist
78 that prevent compliance in some cases.
79 Applications that depend on standards conformance might fail due to non-standard
80 behavior when checking file system free space.
82 A logical volume exported as a raw or block device.
83 This type of dataset should only be used when a block device is required.
84 File systems are typically used in most environments.
86 A read-only version of a file system or volume at a given point in time.
88 .Ar filesystem Ns @ Ns Ar name
90 .Ar volume Ns @ Ns Ar name .
94 but without the hold on on-disk data.
95 It can be used as the source of a send (but not for a receive). It is specified as
96 .Ar filesystem Ns # Ns Ar name
98 .Ar volume Ns # Ns Ar name .
104 Properties are divided into two types, native properties and user-defined
109 Native properties either export internal statistics or control ZFS behavior.
110 In addition, native properties are either editable or read-only.
111 User properties have no effect on ZFS behavior, but you can use them to annotate
112 datasets in a way that is meaningful in your environment.
113 For more information about properties, see the
114 .Xr zfsprops 8 man page.
118 feature allows for the creation of encrypted filesystems and volumes.
119 ZFS will encrypt file and zvol data, file attributes, ACLs, permission bits,
120 directory listings, FUID mappings, and
125 For an overview of encryption see the
126 .Xr zfs-load-key 8 command manual.
128 All subcommands that modify state are logged persistently to the pool in their
132 Displays a help message.
144 Displays the software version of the
146 userland utility and the zfs kernel module.
148 .Ss Dataset Management
151 Lists the property information for the given datasets in tabular form.
153 Creates a new ZFS file system or volume.
155 Destroys the given dataset(s), snapshot(s), or bookmark.
157 Renames the given dataset (filesystem or snapshot).
159 Manage upgrading the on-disk version of filesystems.
163 .It Xr zfs-snapshot 8
164 Creates snapshots with the given names.
165 .It Xr zfs-rollback 8
166 Roll back the given dataset to a previous snapshot.
171 Add or remove a hold reference to the specified snapshot or snapshots.
172 If a hold exists on a snapshot, attempts to destroy that snapshot by using the
177 Display the difference between a snapshot of a given filesystem and another
178 snapshot of that filesystem from a later time or the current contents of the
184 Creates a clone of the given snapshot.
186 Promotes a clone file system to no longer be dependent on its
193 Generate a send stream, which may be of a filesystem, and may be incremental
196 Creates a snapshot whose contents are as specified in the stream provided on
198 If a full stream is received, then a new file system is created as well.
199 Streams are created using the
201 subcommand, which by default creates a full stream.
202 .It Xr zfs-bookmark 8
203 Creates a new bookmark of the given snapshot or bookmark.
204 Bookmarks mark the point in time when the snapshot was created, and can be used
205 as the incremental source for a
209 Generate a new redaction bookmark.
210 This feature can be used to allow clones of a filesystem to be made available on
211 a remote system, in the case where their parent need not (or needs to not) be
217 Displays properties for the given datasets.
219 Sets the property or list of properties to the given value(s) for each dataset.
221 Clears the specified property, causing it to be inherited from an ancestor,
222 restored to default if no ancestor has the property set, or with the
224 option reverted to the received value if one exists.
229 .Xr zfs-userspace 8 /
230 .Xr zfs-groupspace 8 /
231 .Xr zfs-projectspace 8
233 Displays space consumed by, and quotas on, each user, group, or project
234 in the specified filesystem or snapshot.
236 List, set, or clear project ID and/or inherit flag on the file(s) or directories.
241 Displays all ZFS file systems currently mounted, or mount ZFS filesystem
242 on a path described by its
246 Unmounts currently mounted ZFS file systems.
251 Shares available ZFS file systems.
253 Unshares currently shared ZFS file systems.
255 .Ss Delegated Administration
258 Delegate permissions on the specified filesystem or volume.
260 Remove delegated permissions on the specified filesystem or volume.
264 .It Xr zfs-change-key 8
265 Add or change an encryption key on the specified dataset.
266 .It Xr zfs-load-key 8
267 Load the key for the specified encrypted dataset, enabling access.
268 .It Xr zfs-unload-key 8
269 Unload a key for the specified dataset, removing the ability to access the dataset.
274 Execute ZFS administrative operations
275 programmatically via a Lua script-language channel program.
280 Attaches a filesystem to a jail.
282 Detaches a filesystem from a jail.
287 Wait for background activity in a filesystem to complete.
292 utility exits 0 on success, 1 if an error occurs, and 2 if invalid command line
293 options were specified.
296 .It Sy Example 1 No Creating a ZFS File System Hierarchy
297 The following commands create a file system named
299 and a file system named
303 is set for the parent file system, and is automatically inherited by the child
306 # zfs create pool/home
307 # zfs set mountpoint=/export/home pool/home
308 # zfs create pool/home/bob
310 .It Sy Example 2 No Creating a ZFS Snapshot
311 The following command creates a snapshot named
313 This snapshot is mounted on demand in the
315 directory at the root of the
319 # zfs snapshot pool/home/bob@yesterday
321 .It Sy Example 3 No Creating and Destroying Multiple Snapshots
322 The following command creates snapshots named
326 and all of its descendent file systems.
327 Each snapshot is mounted on demand in the
329 directory at the root of its file system.
330 The second command destroys the newly created snapshots.
332 # zfs snapshot -r pool/home@yesterday
333 # zfs destroy -r pool/home@yesterday
335 .It Sy Example 4 No Disabling and Enabling File System Compression
336 The following command disables the
338 property for all file systems under
340 The next command explicitly enables
345 # zfs set compression=off pool/home
346 # zfs set compression=on pool/home/anne
348 .It Sy Example 5 No Listing ZFS Datasets
349 The following command lists all active file systems and volumes in the system.
350 Snapshots are displayed if the
358 for more information on pool properties.
361 NAME USED AVAIL REFER MOUNTPOINT
362 pool 450K 457G 18K /pool
363 pool/home 315K 457G 21K /export/home
364 pool/home/anne 18K 457G 18K /export/home/anne
365 pool/home/bob 276K 457G 276K /export/home/bob
367 .It Sy Example 6 No Setting a Quota on a ZFS File System
368 The following command sets a quota of 50 Gbytes for
371 # zfs set quota=50G pool/home/bob
373 .It Sy Example 7 No Listing ZFS Properties
374 The following command lists all properties for
377 # zfs get all pool/home/bob
378 NAME PROPERTY VALUE SOURCE
379 pool/home/bob type filesystem -
380 pool/home/bob creation Tue Jul 21 15:53 2009 -
381 pool/home/bob used 21K -
382 pool/home/bob available 20.0G -
383 pool/home/bob referenced 21K -
384 pool/home/bob compressratio 1.00x -
385 pool/home/bob mounted yes -
386 pool/home/bob quota 20G local
387 pool/home/bob reservation none default
388 pool/home/bob recordsize 128K default
389 pool/home/bob mountpoint /pool/home/bob default
390 pool/home/bob sharenfs off default
391 pool/home/bob checksum on default
392 pool/home/bob compression on local
393 pool/home/bob atime on default
394 pool/home/bob devices on default
395 pool/home/bob exec on default
396 pool/home/bob setuid on default
397 pool/home/bob readonly off default
398 pool/home/bob zoned off default
399 pool/home/bob snapdir hidden default
400 pool/home/bob acltype off default
401 pool/home/bob aclmode discard default
402 pool/home/bob aclinherit restricted default
403 pool/home/bob canmount on default
404 pool/home/bob xattr on default
405 pool/home/bob copies 1 default
406 pool/home/bob version 4 -
407 pool/home/bob utf8only off -
408 pool/home/bob normalization none -
409 pool/home/bob casesensitivity sensitive -
410 pool/home/bob vscan off default
411 pool/home/bob nbmand off default
412 pool/home/bob sharesmb off default
413 pool/home/bob refquota none default
414 pool/home/bob refreservation none default
415 pool/home/bob primarycache all default
416 pool/home/bob secondarycache all default
417 pool/home/bob usedbysnapshots 0 -
418 pool/home/bob usedbydataset 21K -
419 pool/home/bob usedbychildren 0 -
420 pool/home/bob usedbyrefreservation 0 -
423 The following command gets a single property value.
425 # zfs get -H -o value compression pool/home/bob
428 The following command lists all properties with local settings for
431 # zfs get -r -s local -o name,property,value all pool/home/bob
433 pool/home/bob quota 20G
434 pool/home/bob compression on
436 .It Sy Example 8 No Rolling Back a ZFS File System
437 The following command reverts the contents of
439 to the snapshot named
441 deleting all intermediate snapshots.
443 # zfs rollback -r pool/home/anne@yesterday
445 .It Sy Example 9 No Creating a ZFS Clone
446 The following command creates a writable file system whose initial contents are
448 .Em pool/home/bob@yesterday .
450 # zfs clone pool/home/bob@yesterday pool/clone
452 .It Sy Example 10 No Promoting a ZFS Clone
453 The following commands illustrate how to test out changes to a file system, and
454 then replace the original file system with the changed one, using clones, clone
455 promotion, and renaming:
457 # zfs create pool/project/production
458 populate /pool/project/production with data
459 # zfs snapshot pool/project/production@today
460 # zfs clone pool/project/production@today pool/project/beta
461 make changes to /pool/project/beta and test them
462 # zfs promote pool/project/beta
463 # zfs rename pool/project/production pool/project/legacy
464 # zfs rename pool/project/beta pool/project/production
465 once the legacy version is no longer needed, it can be destroyed
466 # zfs destroy pool/project/legacy
468 .It Sy Example 11 No Inheriting ZFS Properties
469 The following command causes
475 property from their parent.
477 # zfs inherit checksum pool/home/bob pool/home/anne
479 .It Sy Example 12 No Remotely Replicating ZFS Data
480 The following commands send a full stream and then an incremental stream to a
481 remote machine, restoring them into
482 .Em poolB/received/fs@a
484 .Em poolB/received/fs@b ,
487 must contain the file system
489 and must not initially contain
490 .Em poolB/received/fs .
492 # zfs send pool/fs@a | \e
493 ssh host zfs receive poolB/received/fs@a
494 # zfs send -i a pool/fs@b | \e
495 ssh host zfs receive poolB/received/fs
497 .It Sy Example 13 No Using the zfs receive -d Option
498 The following command sends a full stream of
499 .Em poolA/fsA/fsB@snap
500 to a remote machine, receiving it into
501 .Em poolB/received/fsA/fsB@snap .
504 portion of the received snapshot's name is determined from the name of the sent
507 must contain the file system
510 .Em poolB/received/fsA
511 does not exist, it is created as an empty file system.
513 # zfs send poolA/fsA/fsB@snap | \e
514 ssh host zfs receive -d poolB/received
516 .It Sy Example 14 No Setting User Properties
517 The following example sets the user-defined
518 .Sy com.example:department
519 property for a dataset.
521 # zfs set com.example:department=12345 tank/accounting
523 .It Sy Example 15 No Performing a Rolling Snapshot
524 The following example shows how to maintain a history of snapshots with a
525 consistent naming scheme.
526 To keep a week's worth of snapshots, the user destroys the oldest snapshot,
527 renames the remaining snapshots, and then creates a new snapshot, as follows:
529 # zfs destroy -r pool/users@7daysago
530 # zfs rename -r pool/users@6daysago @7daysago
531 # zfs rename -r pool/users@5daysago @6daysago
532 # zfs rename -r pool/users@4daysago @5daysago
533 # zfs rename -r pool/users@3daysago @4daysago
534 # zfs rename -r pool/users@2daysago @3daysago
535 # zfs rename -r pool/users@yesterday @2daysago
536 # zfs rename -r pool/users@today @yesterday
537 # zfs snapshot -r pool/users@today
539 .It Sy Example 16 No Setting sharenfs Property Options on a ZFS File System
540 The following commands show how to set
542 property options to enable
546 addresses and to enable root access for system
552 # zfs set sharenfs='rw=@123.123.0.0/16,root=neo' tank/home
557 for host name resolution, specify the fully qualified hostname.
558 .It Sy Example 17 No Delegating ZFS Administration Permissions on a ZFS Dataset
559 The following example shows how to set permissions so that user
561 can create, destroy, mount, and take snapshots on
567 # zfs allow cindys create,destroy,mount,snapshot tank/cindys
568 # zfs allow tank/cindys
569 ---- Permissions on tank/cindys --------------------------------------
570 Local+Descendent permissions:
571 user cindys create,destroy,mount,snapshot
576 mount point permission is set to 755 by default, user
578 will be unable to mount file systems under
580 Add an ACE similar to the following syntax to provide mount point access:
582 # chmod A+user:cindys:add_subdirectory:allow /tank/cindys
584 .It Sy Example 18 No Delegating Create Time Permissions on a ZFS Dataset
585 The following example shows how to grant anyone in the group
587 to create file systems in
589 This syntax also allows staff members to destroy their own file systems, but not
590 destroy anyone else's file system.
595 # zfs allow staff create,mount tank/users
596 # zfs allow -c destroy tank/users
597 # zfs allow tank/users
598 ---- Permissions on tank/users ---------------------------------------
601 Local+Descendent permissions:
602 group staff create,mount
604 .It Sy Example 19 No Defining and Granting a Permission Set on a ZFS Dataset
605 The following example shows how to define and grant a permission set on the
612 # zfs allow -s @pset create,destroy,snapshot,mount tank/users
613 # zfs allow staff @pset tank/users
614 # zfs allow tank/users
615 ---- Permissions on tank/users ---------------------------------------
617 @pset create,destroy,mount,snapshot
618 Local+Descendent permissions:
621 .It Sy Example 20 No Delegating Property Permissions on a ZFS Dataset
622 The following example shows to grant the ability to set quotas and reservations
630 # zfs allow cindys quota,reservation users/home
631 # zfs allow users/home
632 ---- Permissions on users/home ---------------------------------------
633 Local+Descendent permissions:
634 user cindys quota,reservation
635 cindys% zfs set quota=10G users/home/marks
636 cindys% zfs get quota users/home/marks
637 NAME PROPERTY VALUE SOURCE
638 users/home/marks quota 10G local
640 .It Sy Example 21 No Removing ZFS Delegated Permissions on a ZFS Dataset
641 The following example shows how to remove the snapshot permission from the
650 # zfs unallow staff snapshot tank/users
651 # zfs allow tank/users
652 ---- Permissions on tank/users ---------------------------------------
654 @pset create,destroy,mount,snapshot
655 Local+Descendent permissions:
658 .It Sy Example 22 No Showing the differences between a snapshot and a ZFS Dataset
659 The following example shows how to see what has changed between a prior
660 snapshot of a ZFS dataset and its current state.
663 option is used to indicate type information for the files affected.
665 # zfs diff -F tank/test@before tank/test
667 M F /tank/test/linked (+1)
668 R F /tank/test/oldname -> /tank/test/newname
669 - F /tank/test/deleted
670 + F /tank/test/created
671 M F /tank/test/modified
673 .It Sy Example 23 No Creating a bookmark
674 The following example create a bookmark to a snapshot.
675 This bookmark can then be used instead of snapshot in send streams.
677 # zfs bookmark rpool@snapshot rpool#bookmark
679 .It Sy Example 24 No Setting sharesmb Property Options on a ZFS File System
680 The following example show how to share SMB filesystem through ZFS.
681 Note that that a user and his/her password must be given.
683 # smbmount //127.0.0.1/share_tmp /mnt/tmp \\
684 -o user=workgroup/turbo,password=obrut,uid=1000
688 .Em /etc/samba/smb.conf
689 configuration required:
691 Samba will need to listen to 'localhost' (127.0.0.1) for the ZFS utilities to
692 communicate with Samba.
693 This is the default behavior for most Linux distributions.
695 Samba must be able to authenticate a user.
696 This can be done in a number of ways, depending on if using the system password file, LDAP or the Samba
697 specific smbpasswd file.
698 How to do this is outside the scope of this manual.
701 man page for more information.
704 .Sy USERSHARE section
707 man page for all configuration options in case you need to modify any options
708 to the share afterwards.
709 Do note that any changes done with the
711 command will be undone if the share is ever unshared (such as at a reboot etc).
713 .Sh ENVIRONMENT VARIABLES
714 .Bl -tag -width "ZFS_MOUNT_HELPER"
715 .It Ev ZFS_MOUNT_HELPER
720 to mount zfs datasets. This option is provided for backwards compatibility with older zfs versions.
722 .Sh INTERFACE STABILITY
741 .Xr zfs-change-key 8 ,
747 .Xr zfs-groupspace 8 ,
756 .Xr zfs-projectspace 8 ,
769 .Xr zfs-unload-key 8 ,
773 .Xr zfs-userspace 8 ,