Files
mirror_zfs/man/man8/zfs.8
T

847 lines
27 KiB
Plaintext
Raw Normal View History

2025-01-04 11:04:27 +11:00
.\" SPDX-License-Identifier: CDDL-1.0
.\"
.\" CDDL HEADER START
.\"
.\" The contents of this file are subject to the terms of the
.\" Common Development and Distribution License (the "License").
.\" You may not use this file except in compliance with the License.
.\"
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2022-07-11 23:16:13 +02:00
.\" or https://opensource.org/licenses/CDDL-1.0.
.\" See the License for the specific language governing permissions
.\" and limitations under the License.
.\"
.\" When distributing Covered Code, include this CDDL HEADER in each
.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
.\" If applicable, add the following below this CDDL HEADER, with the
.\" fields enclosed by brackets "[]" replaced with your own identifying
.\" information: Portions Copyright [yyyy] [name of copyright owner]
.\"
.\" CDDL HEADER END
.\"
.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
.\" Copyright (c) 2011, 2019 by Delphix. All rights reserved.
2019-12-11 11:58:37 -08:00
.\" Copyright (c) 2011, Pawel Jakub Dawidek <pjd@FreeBSD.org>
.\" Copyright (c) 2012, Glen Barber <gjb@FreeBSD.org>
.\" Copyright (c) 2012, Bryan Drewery <bdrewery@FreeBSD.org>
.\" Copyright (c) 2013, Steven Hartland <smh@FreeBSD.org>
.\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
2017-06-29 09:55:30 -07:00
.\" Copyright (c) 2014, Joyent, Inc. All rights reserved.
.\" Copyright (c) 2014 by Adam Stevko. All rights reserved.
.\" Copyright (c) 2014 Integros [integros.com]
2019-12-11 11:58:37 -08:00
.\" Copyright (c) 2014, Xin LI <delphij@FreeBSD.org>
.\" Copyright (c) 2014-2015, The FreeBSD Foundation, All Rights Reserved.
.\" Copyright (c) 2016 Nexenta Systems, Inc. All Rights Reserved.
2019-04-14 20:46:19 -05:00
.\" Copyright 2019 Richard Laager. All rights reserved.
.\" Copyright 2018 Nexenta Systems, Inc.
2019-07-16 13:19:24 -05:00
.\" Copyright 2019 Joyent, Inc.
.\"
.Dd May 12, 2025
2019-11-12 14:17:40 -05:00
.Dt ZFS 8
2020-08-21 14:55:47 -04:00
.Os
2021-05-27 02:46:40 +02:00
.
2017-06-29 09:55:30 -07:00
.Sh NAME
.Nm zfs
2021-05-27 02:46:40 +02:00
.Nd configure ZFS datasets
2017-06-29 09:55:30 -07:00
.Sh SYNOPSIS
.Nm
.Fl ?V
2017-06-29 09:55:30 -07:00
.Nm
.Cm version
.Op Fl j
2019-11-12 14:17:40 -05:00
.Nm
2021-05-27 02:46:40 +02:00
.Cm subcommand
.Op Ar arguments
.
2017-06-29 09:55:30 -07:00
.Sh DESCRIPTION
The
.Nm
command configures ZFS datasets within a ZFS storage pool, as described in
.Xr zpool 8 .
2022-04-11 15:14:38 +02:00
A dataset is identified by a unique path within the ZFS namespace:
2017-06-29 09:55:30 -07:00
.Pp
2022-04-11 15:14:38 +02:00
.D1 Ar pool Ns Oo Sy / Ns Ar component Oc Ns Sy / Ns Ar component
.Pp
for example:
.Pp
.Dl rpool/var/log
.Pp
The maximum length of a dataset name is
.Sy ZFS_MAX_DATASET_NAME_LEN No - 1
ASCII characters (currently 255) satisfying
.Sy [A-Za-z_.:/ -] .
Additionally snapshots are allowed to contain a single
.Sy @
character, while bookmarks are allowed to contain a single
.Sy #
character.
.Sy /
is used as separator between components.
The maximum amount of nesting allowed in a path is
.Sy zfs_max_dataset_nesting
levels deep.
ZFS tunables
.Pq Sy zfs_*
are explained in
.Xr zfs 4 .
2017-06-29 09:55:30 -07:00
.Pp
A dataset can be one of the following:
2021-05-27 02:46:40 +02:00
.Bl -tag -offset Ds -width "file system"
2017-06-29 09:55:30 -07:00
.It Sy file system
2021-05-27 02:46:40 +02:00
Can be mounted within the standard system namespace and behaves like other file
2017-06-29 09:55:30 -07:00
systems.
2021-05-27 02:46:40 +02:00
While ZFS file systems are designed to be POSIX-compliant, known issues exist
2017-06-29 09:55:30 -07:00
that prevent compliance in some cases.
Applications that depend on standards conformance might fail due to non-standard
behavior when checking file system free space.
.It Sy volume
A logical volume exported as a raw or block device.
2019-04-14 20:46:19 -05:00
This type of dataset should only be used when a block device is required.
2017-06-29 09:55:30 -07:00
File systems are typically used in most environments.
.It Sy snapshot
A read-only version of a file system or volume at a given point in time.
It is specified as
.Ar filesystem Ns @ Ns Ar name
or
.Ar volume Ns @ Ns Ar name .
.It Sy bookmark
Much like a
.Sy snapshot ,
2019-11-12 14:17:40 -05:00
but without the hold on on-disk data.
2021-05-27 02:46:40 +02:00
It can be used as the source of a send (but not for a receive).
It is specified as
2017-06-29 09:55:30 -07:00
.Ar filesystem Ns # Ns Ar name
or
.Ar volume Ns # Ns Ar name .
.El
2017-10-30 16:18:26 -04:00
.Pp
2021-05-27 02:46:40 +02:00
See
.Xr zfsconcepts 7
2021-05-27 02:46:40 +02:00
for details.
.
2019-11-12 14:17:40 -05:00
.Ss Properties
2021-05-27 02:46:40 +02:00
Properties are divided into two types: native properties and user-defined
.Pq or Qq user
2017-06-29 09:55:30 -07:00
properties.
Native properties either export internal statistics or control ZFS behavior.
In addition, native properties are either editable or read-only.
User properties have no effect on ZFS behavior, but you can use them to annotate
datasets in a way that is meaningful in your environment.
2021-05-27 02:46:40 +02:00
For more information about properties, see
.Xr zfsprops 7 .
2021-05-27 02:46:40 +02:00
.
2019-11-12 14:17:40 -05:00
.Ss Encryption
Enabling the
.Sy encryption
feature allows for the creation of encrypted filesystems and volumes.
ZFS will encrypt file and zvol data, file attributes, ACLs, permission bits,
directory listings, FUID mappings, and
2021-05-27 02:46:40 +02:00
.Sy userused Ns / Ns Sy groupused Ns / Ns Sy projectused
2019-11-12 14:17:40 -05:00
data.
2021-05-27 02:46:40 +02:00
For an overview of encryption, see
.Xr zfs-load-key 8 .
.
2019-11-12 14:17:40 -05:00
.Sh SUBCOMMANDS
All subcommands that modify state are logged persistently to the pool in their
original form.
2017-06-29 09:55:30 -07:00
.Bl -tag -width ""
2019-11-12 14:17:40 -05:00
.It Nm Fl ?
Displays a help message.
2017-06-29 09:55:30 -07:00
.It Xo
2019-11-12 14:17:40 -05:00
.Nm
.Fl V , -version
2017-06-29 09:55:30 -07:00
.Xc
2019-11-12 14:17:40 -05:00
.It Xo
.Nm
.Cm version
.Op Fl j
2019-11-12 14:17:40 -05:00
.Xc
Displays the software version of the
.Nm
userland utility and the zfs kernel module.
Use
.Fl j
option to output in JSON format.
2017-06-29 09:55:30 -07:00
.El
2021-05-27 02:46:40 +02:00
.
2019-11-12 14:17:40 -05:00
.Ss Dataset Management
.Bl -tag -width ""
.It Xr zfs-list 8
Lists the property information for the given datasets in tabular form.
.It Xr zfs-create 8
Creates a new ZFS file system or volume.
.It Xr zfs-destroy 8
Destroys the given dataset(s), snapshot(s), or bookmark.
.It Xr zfs-rename 8
Renames the given dataset (filesystem or snapshot).
.It Xr zfs-upgrade 8
Manage upgrading the on-disk version of filesystems.
2017-06-29 09:55:30 -07:00
.El
2021-05-27 02:46:40 +02:00
.
2019-11-12 14:17:40 -05:00
.Ss Snapshots
.Bl -tag -width ""
.It Xr zfs-snapshot 8
Creates snapshots with the given names.
.It Xr zfs-rollback 8
Roll back the given dataset to a previous snapshot.
2021-05-27 02:46:40 +02:00
.It Xr zfs-hold 8 Ns / Ns Xr zfs-release 8
2019-11-12 14:17:40 -05:00
Add or remove a hold reference to the specified snapshot or snapshots.
If a hold exists on a snapshot, attempts to destroy that snapshot by using the
.Nm zfs Cm destroy
command return
2021-05-27 02:46:40 +02:00
.Sy EBUSY .
2019-11-12 14:17:40 -05:00
.It Xr zfs-diff 8
Display the difference between a snapshot of a given filesystem and another
snapshot of that filesystem from a later time or the current contents of the
filesystem.
.El
2021-05-27 02:46:40 +02:00
.
2019-11-12 14:17:40 -05:00
.Ss Clones
.Bl -tag -width ""
.It Xr zfs-clone 8
Creates a clone of the given snapshot.
.It Xr zfs-promote 8
Promotes a clone file system to no longer be dependent on its
.Qq origin
snapshot.
.El
2021-05-27 02:46:40 +02:00
.
2019-11-12 14:17:40 -05:00
.Ss Send & Receive
.Bl -tag -width ""
.It Xr zfs-send 8
Generate a send stream, which may be of a filesystem, and may be incremental
from a bookmark.
.It Xr zfs-receive 8
Creates a snapshot whose contents are as specified in the stream provided on
standard input.
If a full stream is received, then a new file system is created as well.
Streams are created using the
.Xr zfs-send 8
subcommand, which by default creates a full stream.
.It Xr zfs-bookmark 8
2019-11-10 23:24:14 -08:00
Creates a new bookmark of the given snapshot or bookmark.
2019-11-12 14:17:40 -05:00
Bookmarks mark the point in time when the snapshot was created, and can be used
as the incremental source for a
.Nm zfs Cm send
command.
.It Xr zfs-redact 8
Generate a new redaction bookmark.
This feature can be used to allow clones of a filesystem to be made available on
a remote system, in the case where their parent need not (or needs to not) be
usable.
.El
2021-05-27 02:46:40 +02:00
.
2019-11-12 14:17:40 -05:00
.Ss Properties
.Bl -tag -width ""
.It Xr zfs-get 8
Displays properties for the given datasets.
.It Xr zfs-set 8
Sets the property or list of properties to the given value(s) for each dataset.
.It Xr zfs-inherit 8
Clears the specified property, causing it to be inherited from an ancestor,
restored to default if no ancestor has the property set, or with the
.Fl S
option reverted to the received value if one exists.
.El
2021-05-27 02:46:40 +02:00
.
2019-11-12 14:17:40 -05:00
.Ss Quotas
.Bl -tag -width ""
2021-05-27 02:46:40 +02:00
.It Xr zfs-userspace 8 Ns / Ns Xr zfs-groupspace 8 Ns / Ns Xr zfs-projectspace 8
2019-11-12 14:17:40 -05:00
Displays space consumed by, and quotas on, each user, group, or project
in the specified filesystem or snapshot.
.It Xr zfs-project 8
List, set, or clear project ID and/or inherit flag on the files or directories.
2018-02-14 06:54:54 +08:00
.El
2021-05-27 02:46:40 +02:00
.
2019-11-12 14:17:40 -05:00
.Ss Mountpoints
.Bl -tag -width ""
.It Xr zfs-mount 8
Displays all ZFS file systems currently mounted, or mount ZFS filesystem
on a path described by its
.Sy mountpoint
2019-11-12 14:17:40 -05:00
property.
.It Xr zfs-unmount 8
2017-06-29 09:55:30 -07:00
Unmounts currently mounted ZFS file systems.
2019-06-28 15:38:37 -04:00
.El
2021-05-27 02:46:40 +02:00
.
2019-11-12 14:17:40 -05:00
.Ss Shares
.Bl -tag -width ""
.It Xr zfs-share 8
2017-06-29 09:55:30 -07:00
Shares available ZFS file systems.
2019-11-12 14:17:40 -05:00
.It Xr zfs-unshare 8
2017-06-29 09:55:30 -07:00
Unshares currently shared ZFS file systems.
.El
2021-05-27 02:46:40 +02:00
.
2019-11-12 14:17:40 -05:00
.Ss Delegated Administration
2018-02-08 09:16:23 -07:00
.Bl -tag -width ""
2019-11-12 14:17:40 -05:00
.It Xr zfs-allow 8
Delegate permissions on the specified filesystem or volume.
.It Xr zfs-unallow 8
Remove delegated permissions on the specified filesystem or volume.
2017-08-14 13:36:48 -04:00
.El
2021-05-27 02:46:40 +02:00
.
2019-11-12 14:17:40 -05:00
.Ss Encryption
.Bl -tag -width ""
.It Xr zfs-change-key 8
Add or change an encryption key on the specified dataset.
.It Xr zfs-load-key 8
Load the key for the specified encrypted dataset, enabling access.
.It Xr zfs-unload-key 8
Unload a key for the specified dataset,
removing the ability to access the dataset.
2019-11-12 14:17:40 -05:00
.El
2021-05-27 02:46:40 +02:00
.
2019-11-12 14:17:40 -05:00
.Ss Channel Programs
.Bl -tag -width ""
.It Xr zfs-program 8
Execute ZFS administrative operations
programmatically via a Lua script-language channel program.
2017-06-29 09:55:30 -07:00
.El
2021-05-27 02:46:40 +02:00
.
2025-05-12 13:22:17 -04:00
.Ss Data rewrite
.Bl -tag -width ""
.It Xr zfs-rewrite 8
Rewrite specified files without modification.
.El
.
2019-12-11 11:58:37 -08:00
.Ss Jails
.Bl -tag -width ""
.It Xr zfs-jail 8
Attaches a filesystem to a jail.
.It Xr zfs-unjail 8
Detaches a filesystem from a jail.
.El
2021-05-27 02:46:40 +02:00
.
2020-04-01 10:02:06 -07:00
.Ss Waiting
.Bl -tag -width ""
.It Xr zfs-wait 8
Wait for background activity in a filesystem to complete.
.El
2021-05-27 02:46:40 +02:00
.
2017-06-29 09:55:30 -07:00
.Sh EXIT STATUS
The
.Nm
2021-05-27 02:46:40 +02:00
utility exits
.Sy 0
on success,
.Sy 1
if an error occurs, and
.Sy 2
if invalid command line options were specified.
.
2017-06-29 09:55:30 -07:00
.Sh EXAMPLES
.\" Examples 1, 4, 6, 7, 11, 14, 16 are shared with zfs-set.8.
.\" Examples 1, 10 are shared with zfs-create.8.
.\" Examples 2, 3, 10, 15 are also shared with zfs-snapshot.8.
.\" Examples 3, 10, 15 are shared with zfs-destroy.8.
2022-03-16 18:33:41 +01:00
.\" Examples 5 are shared with zfs-list.8.
.\" Examples 8 are shared with zfs-rollback.8.
.\" Examples 9, 10 are shared with zfs-clone.8.
.\" Examples 10 are also shared with zfs-promote.8.
.\" Examples 10, 15 also are shared with zfs-rename.8.
.\" Examples 12, 13 are shared with zfs-send.8.
.\" Examples 12, 13 are also shared with zfs-receive.8.
.\" Examples 17, 18, 19, 20, 21 are shared with zfs-allow.8.
2022-03-16 18:27:44 +01:00
.\" Examples 22 are shared with zfs-diff.8.
.\" Examples 23 are shared with zfs-bookmark.8.
.\" Make sure to update them omnidirectionally
.Ss Example 1 : No Creating a ZFS File System Hierarchy
2017-06-29 09:55:30 -07:00
The following commands create a file system named
2021-05-27 02:46:40 +02:00
.Ar pool/home
2017-06-29 09:55:30 -07:00
and a file system named
2021-05-27 02:46:40 +02:00
.Ar pool/home/bob .
2017-06-29 09:55:30 -07:00
The mount point
.Pa /export/home
is set for the parent file system, and is automatically inherited by the child
file system.
2021-05-27 02:46:40 +02:00
.Dl # Nm zfs Cm create Ar pool/home
.Dl # Nm zfs Cm set Sy mountpoint Ns = Ns Ar /export/home pool/home
.Dl # Nm zfs Cm create Ar pool/home/bob
.
.Ss Example 2 : No Creating a ZFS Snapshot
2017-06-29 09:55:30 -07:00
The following command creates a snapshot named
2021-05-27 02:46:40 +02:00
.Ar yesterday .
2017-06-29 09:55:30 -07:00
This snapshot is mounted on demand in the
.Pa .zfs/snapshot
directory at the root of the
2021-05-27 02:46:40 +02:00
.Ar pool/home/bob
2017-06-29 09:55:30 -07:00
file system.
2021-05-27 02:46:40 +02:00
.Dl # Nm zfs Cm snapshot Ar pool/home/bob Ns @ Ns Ar yesterday
.
.Ss Example 3 : No Creating and Destroying Multiple Snapshots
2017-06-29 09:55:30 -07:00
The following command creates snapshots named
2021-05-27 02:46:40 +02:00
.Ar yesterday No of Ar pool/home
2017-06-29 09:55:30 -07:00
and all of its descendent file systems.
Each snapshot is mounted on demand in the
.Pa .zfs/snapshot
directory at the root of its file system.
The second command destroys the newly created snapshots.
2021-05-27 02:46:40 +02:00
.Dl # Nm zfs Cm snapshot Fl r Ar pool/home Ns @ Ns Ar yesterday
.Dl # Nm zfs Cm destroy Fl r Ar pool/home Ns @ Ns Ar yesterday
.
.Ss Example 4 : No Disabling and Enabling File System Compression
2017-06-29 09:55:30 -07:00
The following command disables the
.Sy compression
property for all file systems under
2021-05-27 02:46:40 +02:00
.Ar pool/home .
2017-06-29 09:55:30 -07:00
The next command explicitly enables
.Sy compression
for
2021-05-27 02:46:40 +02:00
.Ar pool/home/anne .
.Dl # Nm zfs Cm set Sy compression Ns = Ns Sy off Ar pool/home
.Dl # Nm zfs Cm set Sy compression Ns = Ns Sy on Ar pool/home/anne
.
.Ss Example 5 : No Listing ZFS Datasets
2017-06-29 09:55:30 -07:00
The following command lists all active file systems and volumes in the system.
2021-05-27 02:46:40 +02:00
Snapshots are displayed if
.Sy listsnaps Ns = Ns Sy on .
2017-06-29 09:55:30 -07:00
The default is
.Sy off .
See
.Xr zpoolprops 7
2017-06-29 09:55:30 -07:00
for more information on pool properties.
2021-05-27 02:46:40 +02:00
.Bd -literal -compact -offset Ds
.No # Nm zfs Cm list
2017-06-29 09:55:30 -07:00
NAME USED AVAIL REFER MOUNTPOINT
pool 450K 457G 18K /pool
pool/home 315K 457G 21K /export/home
pool/home/anne 18K 457G 18K /export/home/anne
pool/home/bob 276K 457G 276K /export/home/bob
.Ed
2021-05-27 02:46:40 +02:00
.
.Ss Example 6 : No Setting a Quota on a ZFS File System
2017-06-29 09:55:30 -07:00
The following command sets a quota of 50 Gbytes for
2021-05-27 02:46:40 +02:00
.Ar pool/home/bob :
.Dl # Nm zfs Cm set Sy quota Ns = Ns Ar 50G pool/home/bob
.
.Ss Example 7 : No Listing ZFS Properties
2017-06-29 09:55:30 -07:00
The following command lists all properties for
2021-05-27 02:46:40 +02:00
.Ar pool/home/bob :
.Bd -literal -compact -offset Ds
.No # Nm zfs Cm get Sy all Ar pool/home/bob
NAME PROPERTY VALUE SOURCE
pool/home/bob type filesystem -
pool/home/bob creation Tue Jul 21 15:53 2009 -
pool/home/bob used 21K -
pool/home/bob available 20.0G -
pool/home/bob referenced 21K -
pool/home/bob compressratio 1.00x -
pool/home/bob mounted yes -
pool/home/bob quota 20G local
pool/home/bob reservation none default
pool/home/bob recordsize 128K default
pool/home/bob mountpoint /pool/home/bob default
pool/home/bob sharenfs off default
pool/home/bob checksum on default
pool/home/bob compression on local
pool/home/bob atime on default
pool/home/bob devices on default
pool/home/bob exec on default
pool/home/bob setuid on default
pool/home/bob readonly off default
pool/home/bob zoned off default
pool/home/bob snapdir hidden default
2013-10-28 09:22:15 -07:00
pool/home/bob acltype off default
pool/home/bob aclmode discard default
pool/home/bob aclinherit restricted default
pool/home/bob canmount on default
pool/home/bob xattr on default
pool/home/bob copies 1 default
pool/home/bob version 4 -
pool/home/bob utf8only off -
pool/home/bob normalization none -
pool/home/bob casesensitivity sensitive -
pool/home/bob vscan off default
pool/home/bob nbmand off default
pool/home/bob sharesmb off default
pool/home/bob refquota none default
pool/home/bob refreservation none default
pool/home/bob primarycache all default
pool/home/bob secondarycache all default
pool/home/bob usedbysnapshots 0 -
pool/home/bob usedbydataset 21K -
pool/home/bob usedbychildren 0 -
pool/home/bob usedbyrefreservation 0 -
2017-06-29 09:55:30 -07:00
.Ed
.Pp
2021-05-27 02:46:40 +02:00
The following command gets a single property value:
.Bd -literal -compact -offset Ds
.No # Nm zfs Cm get Fl H o Sy value compression Ar pool/home/bob
on
2017-06-29 09:55:30 -07:00
.Ed
2021-05-27 02:46:40 +02:00
.Pp
2017-06-29 09:55:30 -07:00
The following command lists all properties with local settings for
2021-05-27 02:46:40 +02:00
.Ar pool/home/bob :
.Bd -literal -compact -offset Ds
.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
NAME PROPERTY VALUE
pool/home/bob quota 20G
pool/home/bob compression on
2017-06-29 09:55:30 -07:00
.Ed
2021-05-27 02:46:40 +02:00
.
.Ss Example 8 : No Rolling Back a ZFS File System
2017-06-29 09:55:30 -07:00
The following command reverts the contents of
2021-05-27 02:46:40 +02:00
.Ar pool/home/anne
2017-06-29 09:55:30 -07:00
to the snapshot named
2021-05-27 02:46:40 +02:00
.Ar yesterday ,
deleting all intermediate snapshots:
.Dl # Nm zfs Cm rollback Fl r Ar pool/home/anne Ns @ Ns Ar yesterday
.
.Ss Example 9 : No Creating a ZFS Clone
2017-06-29 09:55:30 -07:00
The following command creates a writable file system whose initial contents are
the same as
2021-05-27 02:46:40 +02:00
.Ar pool/home/bob@yesterday .
.Dl # Nm zfs Cm clone Ar pool/home/bob@yesterday pool/clone
.
.Ss Example 10 : No Promoting a ZFS Clone
2017-06-29 09:55:30 -07:00
The following commands illustrate how to test out changes to a file system, and
then replace the original file system with the changed one, using clones, clone
promotion, and renaming:
2021-05-27 02:46:40 +02:00
.Bd -literal -compact -offset Ds
.No # Nm zfs Cm create Ar pool/project/production
populate /pool/project/production with data
2021-05-27 02:46:40 +02:00
.No # Nm zfs Cm snapshot Ar pool/project/production Ns @ Ns Ar today
.No # Nm zfs Cm clone Ar pool/project/production@today pool/project/beta
2017-06-29 09:55:30 -07:00
make changes to /pool/project/beta and test them
2021-05-27 02:46:40 +02:00
.No # Nm zfs Cm promote Ar pool/project/beta
.No # Nm zfs Cm rename Ar pool/project/production pool/project/legacy
.No # Nm zfs Cm rename Ar pool/project/beta pool/project/production
2017-06-29 09:55:30 -07:00
once the legacy version is no longer needed, it can be destroyed
2021-05-27 02:46:40 +02:00
.No # Nm zfs Cm destroy Ar pool/project/legacy
2017-06-29 09:55:30 -07:00
.Ed
2021-05-27 02:46:40 +02:00
.
.Ss Example 11 : No Inheriting ZFS Properties
2017-06-29 09:55:30 -07:00
The following command causes
2021-05-27 02:46:40 +02:00
.Ar pool/home/bob No and Ar pool/home/anne
2017-06-29 09:55:30 -07:00
to inherit the
.Sy checksum
property from their parent.
2021-05-27 02:46:40 +02:00
.Dl # Nm zfs Cm inherit Sy checksum Ar pool/home/bob pool/home/anne
.
.Ss Example 12 : No Remotely Replicating ZFS Data
2017-06-29 09:55:30 -07:00
The following commands send a full stream and then an incremental stream to a
remote machine, restoring them into
.Em poolB/received/fs@a
and
.Em poolB/received/fs@b ,
respectively.
.Em poolB
must contain the file system
.Em poolB/received ,
and must not initially contain
.Em poolB/received/fs .
2021-05-27 02:46:40 +02:00
.Bd -literal -compact -offset Ds
.No # Nm zfs Cm send Ar pool/fs@a |
.No " " Nm ssh Ar host Nm zfs Cm receive Ar poolB/received/fs Ns @ Ns Ar a
.No # Nm zfs Cm send Fl i Ar a pool/fs@b |
.No " " Nm ssh Ar host Nm zfs Cm receive Ar poolB/received/fs
2017-06-29 09:55:30 -07:00
.Ed
2021-05-27 02:46:40 +02:00
.
.Ss Example 13 : No Using the Nm zfs Cm receive Fl d No Option
2017-06-29 09:55:30 -07:00
The following command sends a full stream of
2021-05-27 02:46:40 +02:00
.Ar poolA/fsA/fsB@snap
2017-06-29 09:55:30 -07:00
to a remote machine, receiving it into
2021-05-27 02:46:40 +02:00
.Ar poolB/received/fsA/fsB@snap .
2017-06-29 09:55:30 -07:00
The
2021-05-27 02:46:40 +02:00
.Ar fsA/fsB@snap
2017-06-29 09:55:30 -07:00
portion of the received snapshot's name is determined from the name of the sent
snapshot.
2021-05-27 02:46:40 +02:00
.Ar poolB
2017-06-29 09:55:30 -07:00
must contain the file system
2021-05-27 02:46:40 +02:00
.Ar poolB/received .
2017-06-29 09:55:30 -07:00
If
2021-05-27 02:46:40 +02:00
.Ar poolB/received/fsA
2017-06-29 09:55:30 -07:00
does not exist, it is created as an empty file system.
2021-05-27 02:46:40 +02:00
.Bd -literal -compact -offset Ds
.No # Nm zfs Cm send Ar poolA/fsA/fsB@snap |
.No " " Nm ssh Ar host Nm zfs Cm receive Fl d Ar poolB/received
2017-06-29 09:55:30 -07:00
.Ed
2021-05-27 02:46:40 +02:00
.
.Ss Example 14 : No Setting User Properties
2017-06-29 09:55:30 -07:00
The following example sets the user-defined
2021-05-27 02:46:40 +02:00
.Ar com.example : Ns Ar department
property for a dataset:
.Dl # Nm zfs Cm set Ar com.example : Ns Ar department Ns = Ns Ar 12345 tank/accounting
.
.Ss Example 15 : No Performing a Rolling Snapshot
2017-06-29 09:55:30 -07:00
The following example shows how to maintain a history of snapshots with a
consistent naming scheme.
To keep a week's worth of snapshots, the user destroys the oldest snapshot,
renames the remaining snapshots, and then creates a new snapshot, as follows:
2021-05-27 02:46:40 +02:00
.Bd -literal -compact -offset Ds
.No # Nm zfs Cm destroy Fl r Ar pool/users@7daysago
.No # Nm zfs Cm rename Fl r Ar pool/users@6daysago No @ Ns Ar 7daysago
.No # Nm zfs Cm rename Fl r Ar pool/users@5daysago No @ Ns Ar 6daysago
.No # Nm zfs Cm rename Fl r Ar pool/users@4daysago No @ Ns Ar 5daysago
.No # Nm zfs Cm rename Fl r Ar pool/users@3daysago No @ Ns Ar 4daysago
.No # Nm zfs Cm rename Fl r Ar pool/users@2daysago No @ Ns Ar 3daysago
.No # Nm zfs Cm rename Fl r Ar pool/users@yesterday No @ Ns Ar 2daysago
.No # Nm zfs Cm rename Fl r Ar pool/users@today No @ Ns Ar yesterday
.No # Nm zfs Cm snapshot Fl r Ar pool/users Ns @ Ns Ar today
2017-06-29 09:55:30 -07:00
.Ed
2021-05-27 02:46:40 +02:00
.
.Ss Example 16 : No Setting sharenfs Property Options on a ZFS File System
2017-06-29 09:55:30 -07:00
The following commands show how to set
.Sy sharenfs
2021-05-27 02:46:40 +02:00
property options to enable read-write
access for a set of IP addresses and to enable root access for system
.Qq neo
2017-06-29 09:55:30 -07:00
on the
2021-05-27 02:46:40 +02:00
.Ar tank/home
file system:
.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
2017-06-29 09:55:30 -07:00
.Pp
2021-05-27 02:46:40 +02:00
If you are using DNS for host name resolution,
specify the fully-qualified hostname.
.
.Ss Example 17 : No Delegating ZFS Administration Permissions on a ZFS Dataset
2017-06-29 09:55:30 -07:00
The following example shows how to set permissions so that user
2021-05-27 02:46:40 +02:00
.Ar cindys
2017-06-29 09:55:30 -07:00
can create, destroy, mount, and take snapshots on
2021-05-27 02:46:40 +02:00
.Ar tank/cindys .
2017-06-29 09:55:30 -07:00
The permissions on
2021-05-27 02:46:40 +02:00
.Ar tank/cindys
2017-06-29 09:55:30 -07:00
are also displayed.
2021-05-27 02:46:40 +02:00
.Bd -literal -compact -offset Ds
.No # Nm zfs Cm allow Sy cindys create , Ns Sy destroy , Ns Sy mount , Ns Sy snapshot Ar tank/cindys
.No # Nm zfs Cm allow Ar tank/cindys
2017-06-29 09:55:30 -07:00
---- Permissions on tank/cindys --------------------------------------
Local+Descendent permissions:
user cindys create,destroy,mount,snapshot
.Ed
.Pp
Because the
2021-05-27 02:46:40 +02:00
.Ar tank/cindys
2017-06-29 09:55:30 -07:00
mount point permission is set to 755 by default, user
2021-05-27 02:46:40 +02:00
.Ar cindys
2017-06-29 09:55:30 -07:00
will be unable to mount file systems under
2021-05-27 02:46:40 +02:00
.Ar tank/cindys .
2017-06-29 09:55:30 -07:00
Add an ACE similar to the following syntax to provide mount point access:
.Dl # Cm chmod No A+user : Ns Ar cindys Ns :add_subdirectory:allow Ar /tank/cindys
2021-05-27 02:46:40 +02:00
.
.Ss Example 18 : No Delegating Create Time Permissions on a ZFS Dataset
2017-06-29 09:55:30 -07:00
The following example shows how to grant anyone in the group
2021-05-27 02:46:40 +02:00
.Ar staff
2017-06-29 09:55:30 -07:00
to create file systems in
2021-05-27 02:46:40 +02:00
.Ar tank/users .
2017-06-29 09:55:30 -07:00
This syntax also allows staff members to destroy their own file systems, but not
destroy anyone else's file system.
The permissions on
2021-05-27 02:46:40 +02:00
.Ar tank/users
2017-06-29 09:55:30 -07:00
are also displayed.
2021-05-27 02:46:40 +02:00
.Bd -literal -compact -offset Ds
.No # Nm zfs Cm allow Ar staff Sy create , Ns Sy mount Ar tank/users
.No # Nm zfs Cm allow Fl c Sy destroy Ar tank/users
.No # Nm zfs Cm allow Ar tank/users
2017-06-29 09:55:30 -07:00
---- Permissions on tank/users ---------------------------------------
Permission sets:
destroy
Local+Descendent permissions:
group staff create,mount
.Ed
2021-05-27 02:46:40 +02:00
.
.Ss Example 19 : No Defining and Granting a Permission Set on a ZFS Dataset
2017-06-29 09:55:30 -07:00
The following example shows how to define and grant a permission set on the
2021-05-27 02:46:40 +02:00
.Ar tank/users
2017-06-29 09:55:30 -07:00
file system.
The permissions on
2021-05-27 02:46:40 +02:00
.Ar tank/users
2017-06-29 09:55:30 -07:00
are also displayed.
2021-05-27 02:46:40 +02:00
.Bd -literal -compact -offset Ds
.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
.No # Nm zfs Cm allow staff No @ Ns Ar pset tank/users
.No # Nm zfs Cm allow Ar tank/users
2017-06-29 09:55:30 -07:00
---- Permissions on tank/users ---------------------------------------
Permission sets:
@pset create,destroy,mount,snapshot
2017-06-29 09:55:30 -07:00
Local+Descendent permissions:
group staff @pset
.Ed
2021-05-27 02:46:40 +02:00
.
.Ss Example 20 : No Delegating Property Permissions on a ZFS Dataset
2017-06-29 09:55:30 -07:00
The following example shows to grant the ability to set quotas and reservations
on the
2021-05-27 02:46:40 +02:00
.Ar users/home
2017-06-29 09:55:30 -07:00
file system.
The permissions on
2021-05-27 02:46:40 +02:00
.Ar users/home
2017-06-29 09:55:30 -07:00
are also displayed.
2021-05-27 02:46:40 +02:00
.Bd -literal -compact -offset Ds
.No # Nm zfs Cm allow Ar cindys Sy quota , Ns Sy reservation Ar users/home
.No # Nm zfs Cm allow Ar users/home
2017-06-29 09:55:30 -07:00
---- Permissions on users/home ---------------------------------------
Local+Descendent permissions:
user cindys quota,reservation
2017-06-29 09:55:30 -07:00
cindys% zfs set quota=10G users/home/marks
cindys% zfs get quota users/home/marks
NAME PROPERTY VALUE SOURCE
users/home/marks quota 10G local
.Ed
2021-05-27 02:46:40 +02:00
.
.Ss Example 21 : No Removing ZFS Delegated Permissions on a ZFS Dataset
2017-06-29 09:55:30 -07:00
The following example shows how to remove the snapshot permission from the
2021-05-27 02:46:40 +02:00
.Ar staff
2017-06-29 09:55:30 -07:00
group on the
2021-05-27 02:46:40 +02:00
.Sy tank/users
2017-06-29 09:55:30 -07:00
file system.
The permissions on
2021-05-27 02:46:40 +02:00
.Sy tank/users
2017-06-29 09:55:30 -07:00
are also displayed.
2021-05-27 02:46:40 +02:00
.Bd -literal -compact -offset Ds
.No # Nm zfs Cm unallow Ar staff Sy snapshot Ar tank/users
.No # Nm zfs Cm allow Ar tank/users
2017-06-29 09:55:30 -07:00
---- Permissions on tank/users ---------------------------------------
Permission sets:
@pset create,destroy,mount,snapshot
2017-06-29 09:55:30 -07:00
Local+Descendent permissions:
group staff @pset
.Ed
2021-05-27 02:46:40 +02:00
.
.Ss Example 22 : No Showing the differences between a snapshot and a ZFS Dataset
The following example shows how to see what has changed between a prior
2017-06-29 09:55:30 -07:00
snapshot of a ZFS dataset and its current state.
The
.Fl F
option is used to indicate type information for the files affected.
2021-05-27 02:46:40 +02:00
.Bd -literal -compact -offset Ds
.No # Nm zfs Cm diff Fl F Ar tank/test@before tank/test
M / /tank/test/
M F /tank/test/linked (+1)
R F /tank/test/oldname -> /tank/test/newname
- F /tank/test/deleted
+ F /tank/test/created
M F /tank/test/modified
2017-06-29 09:55:30 -07:00
.Ed
2021-05-27 02:46:40 +02:00
.
.Ss Example 23 : No Creating a bookmark
2022-05-12 18:34:24 +02:00
The following example creates a bookmark to a snapshot.
This bookmark can then be used instead of a snapshot in send streams.
2021-05-27 02:46:40 +02:00
.Dl # Nm zfs Cm bookmark Ar rpool Ns @ Ns Ar snapshot rpool Ns # Ns Ar bookmark
.
.Ss Example 24 : No Setting Sy sharesmb No Property Options on a ZFS File System
2019-11-12 14:17:40 -05:00
The following example show how to share SMB filesystem through ZFS.
2021-05-27 02:46:40 +02:00
Note that a user and their password must be given.
.Dl # Nm smbmount Ar //127.0.0.1/share_tmp /mnt/tmp Fl o No user=workgroup/turbo,password=obrut,uid=1000
2017-06-29 09:55:30 -07:00
.Pp
Minimal
2021-05-27 02:46:40 +02:00
.Pa /etc/samba/smb.conf
configuration is required, as follows.
2017-06-29 09:55:30 -07:00
.Pp
2021-05-27 02:46:40 +02:00
Samba will need to bind to the loopback interface for the ZFS utilities to
2019-11-12 14:17:40 -05:00
communicate with Samba.
This is the default behavior for most Linux distributions.
2017-06-29 09:55:30 -07:00
.Pp
2019-11-12 14:17:40 -05:00
Samba must be able to authenticate a user.
2021-05-27 02:46:40 +02:00
This can be done in a number of ways
.Pq Xr passwd 5 , LDAP , Xr smbpasswd 5 , &c.\& .
How to do this is outside the scope of this document refer to
2017-06-29 09:55:30 -07:00
.Xr smb.conf 5
2021-05-27 02:46:40 +02:00
for more information.
2017-06-29 09:55:30 -07:00
.Pp
See the
2021-05-27 02:46:40 +02:00
.Sx USERSHARES
section for all configuration options,
in case you need to modify any options of the share afterwards.
2019-11-12 14:17:40 -05:00
Do note that any changes done with the
2017-06-29 09:55:30 -07:00
.Xr net 8
2021-05-27 02:46:40 +02:00
command will be undone if the share is ever unshared (like via a reboot).
.
2020-05-21 04:02:41 +03:00
.Sh ENVIRONMENT VARIABLES
2022-04-14 23:30:41 +02:00
.Bl -tag -width "ZFS_MODULE_TIMEOUT"
2022-12-12 15:30:51 -08:00
.It Sy ZFS_COLOR
Use ANSI color in
.Nm zfs Cm diff
2023-03-13 23:31:44 +01:00
and
.Nm zfs Cm list
2022-12-12 15:30:51 -08:00
output.
2021-05-27 02:46:40 +02:00
.It Sy ZFS_MOUNT_HELPER
2020-05-21 04:02:41 +03:00
Cause
2021-05-27 02:46:40 +02:00
.Nm zfs Cm mount
2020-05-21 04:02:41 +03:00
to use
2021-05-27 02:46:40 +02:00
.Xr mount 8
to mount ZFS datasets.
This option is provided for backwards compatibility with older ZFS versions.
2022-04-14 23:30:41 +02:00
.
2022-05-09 19:33:55 -04:00
.It Sy ZFS_SET_PIPE_MAX
Tells
.Nm zfs
2025-01-21 07:30:17 -08:00
to set the maximum pipe size for sends/receives.
2022-05-09 19:33:55 -04:00
Disabled by default on Linux
due to an unfixed deadlock in Linux's pipe size handling code.
2022-04-14 23:30:41 +02:00
.
.\" Shared with zpool.8
.It Sy ZFS_MODULE_TIMEOUT
Time, in seconds, to wait for
.Pa /dev/zfs
to appear.
Defaults to
.Sy 10 ,
max
.Sy 600 Pq 10 minutes .
If
.Pf < Sy 0 ,
wait forever; if
.Sy 0 ,
don't wait.
2022-05-09 19:33:55 -04:00
.El
2021-05-27 02:46:40 +02:00
.
2017-06-29 09:55:30 -07:00
.Sh INTERFACE STABILITY
.Sy Committed .
2021-05-27 02:46:40 +02:00
.
2017-06-29 09:55:30 -07:00
.Sh SEE ALSO
2017-09-16 19:51:24 +02:00
.Xr attr 1 ,
2017-06-29 09:55:30 -07:00
.Xr gzip 1 ,
.Xr ssh 1 ,
.Xr chmod 2 ,
2017-09-16 19:51:24 +02:00
.Xr fsync 2 ,
2017-06-29 09:55:30 -07:00
.Xr stat 2 ,
.Xr write 2 ,
.Xr acl 5 ,
2017-09-16 19:51:24 +02:00
.Xr attributes 5 ,
2017-06-29 09:55:30 -07:00
.Xr exports 5 ,
.Xr zfsconcepts 7 ,
.Xr zfsprops 7 ,
2017-06-29 09:55:30 -07:00
.Xr exportfs 8 ,
2017-09-16 19:51:24 +02:00
.Xr mount 8 ,
2017-06-29 09:55:30 -07:00
.Xr net 8 ,
.Xr pam_zfs_key 8 ,
2017-09-16 19:51:24 +02:00
.Xr selinux 8 ,
2020-08-26 22:29:00 -07:00
.Xr zfs-allow 8 ,
.Xr zfs-bookmark 8 ,
.Xr zfs-change-key 8 ,
.Xr zfs-clone 8 ,
.Xr zfs-create 8 ,
.Xr zfs-destroy 8 ,
.Xr zfs-diff 8 ,
.Xr zfs-get 8 ,
.Xr zfs-groupspace 8 ,
.Xr zfs-hold 8 ,
.Xr zfs-inherit 8 ,
.Xr zfs-jail 8 ,
.Xr zfs-list 8 ,
.Xr zfs-load-key 8 ,
.Xr zfs-mount 8 ,
.Xr zfs-program 8 ,
.Xr zfs-project 8 ,
.Xr zfs-projectspace 8 ,
.Xr zfs-promote 8 ,
.Xr zfs-receive 8 ,
.Xr zfs-redact 8 ,
.Xr zfs-release 8 ,
.Xr zfs-rename 8 ,
.Xr zfs-rollback 8 ,
.Xr zfs-send 8 ,
.Xr zfs-set 8 ,
.Xr zfs-share 8 ,
.Xr zfs-snapshot 8 ,
.Xr zfs-unallow 8 ,
.Xr zfs-unjail 8 ,
.Xr zfs-unload-key 8 ,
.Xr zfs-unmount 8 ,
.Xr zfs-unshare 8 ,
.Xr zfs-upgrade 8 ,
.Xr zfs-userspace 8 ,
.Xr zfs-wait 8 ,
2017-09-16 19:51:24 +02:00
.Xr zpool 8