diff --git a/man/man8/zfs.8 b/man/man8/zfs.8 index 92135c986e87..4cff97792a9f 100644 --- a/man/man8/zfs.8 +++ b/man/man8/zfs.8 @@ -1,741 +1,777 @@ .\" .\" 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 .\" or http://www.opensolaris.org/os/licensing. .\" 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 .\" Copyright (c) 2011, 2019 by Delphix. All rights reserved. .\" Copyright (c) 2011, Pawel Jakub Dawidek .\" Copyright (c) 2012, Glen Barber .\" Copyright (c) 2012, Bryan Drewery .\" Copyright (c) 2013, Steven Hartland .\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved. .\" Copyright (c) 2014, Joyent, Inc. All rights reserved. .\" Copyright (c) 2014 by Adam Stevko. All rights reserved. .\" Copyright (c) 2014 Integros [integros.com] .\" Copyright (c) 2014, Xin LI .\" Copyright (c) 2014-2015, The FreeBSD Foundation, All Rights Reserved. .\" Copyright (c) 2016 Nexenta Systems, Inc. All Rights Reserved. .\" Copyright 2019 Richard Laager. All rights reserved. .\" Copyright 2018 Nexenta Systems, Inc. .\" Copyright 2019 Joyent, Inc. .\" .Dd June 30, 2019 .Dt ZFS 8 .Os .Sh NAME .Nm zfs .Nd configures ZFS file systems .Sh SYNOPSIS .Nm .Fl ?V .Nm .Cm version .Nm .Cm .Op Ar .Sh DESCRIPTION The .Nm command configures ZFS datasets within a ZFS storage pool, as described in .Xr zpool 8 . A dataset is identified by a unique path within the ZFS namespace. For example: .Bd -literal pool/{filesystem,volume,snapshot} .Ed .Pp where the maximum length of a dataset name is .Dv MAXNAMELEN .Pq 256 bytes and the maximum amount of nesting allowed in a path is 50 levels deep. .Pp A dataset can be one of the following: .Bl -tag -width "file system" .It Sy file system A ZFS dataset of type .Sy filesystem can be mounted within the standard system namespace and behaves like other file systems. While ZFS file systems are designed to be POSIX compliant, known issues exist 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. This type of dataset should only be used when a block device is required. 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 , but without the hold on on-disk data. It can be used as the source of a send (but not for a receive). It is specified as .Ar filesystem Ns # Ns Ar name or .Ar volume Ns # Ns Ar name . .El .Pp For details see .Xr zfsconcepts 8 . .Ss Properties Properties are divided into two types, native properties and user-defined .Po or .Qq user .Pc 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. For more information about properties, see the .Xr zfsprops 8 man page. .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 .Sy userused / .Sy groupused data. For an overview of encryption see the .Xr zfs-load-key 8 command manual. .Sh SUBCOMMANDS All subcommands that modify state are logged persistently to the pool in their original form. .Bl -tag -width "" .It Nm Fl ? Displays a help message. .It Xo .Nm .Fl V , -version .Xc An alias for the .Nm zfs Cm version subcommand. .It Xo .Nm .Cm version .Xc Displays the software version of the .Nm userland utility and the zfs kernel module. .El .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. .El .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. .It Xo .Xr zfs-hold 8 / .Xr zfs-release 8 .Xc 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 .Er EBUSY . .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 .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 .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 Creates a new bookmark of the given snapshot or bookmark. 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 .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 .Ss Quotas .Bl -tag -width "" .It Xo .Xr zfs-userspace 8 / .Xr zfs-groupspace 8 / .Xr zfs-projectspace 8 .Xc 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 file(s) or directories. .El .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 property. .It Xr zfs-unmount 8 Unmounts currently mounted ZFS file systems. .El .Ss Shares .Bl -tag -width "" .It Xr zfs-share 8 Shares available ZFS file systems. .It Xr zfs-unshare 8 Unshares currently shared ZFS file systems. .El .Ss Delegated Administration .Bl -tag -width "" .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. .El .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. .El .Ss Channel Programs .Bl -tag -width "" .It Xr zfs-program 8 Execute ZFS administrative operations programmatically via a Lua script-language channel program. .El .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 .Ss Waiting .Bl -tag -width "" .It Xr zfs-wait 8 Wait for background activity in a filesystem to complete. .El .Sh EXIT STATUS The .Nm utility exits 0 on success, 1 if an error occurs, and 2 if invalid command line options were specified. .Sh EXAMPLES .Bl -tag -width "" .It Sy Example 1 No Creating a ZFS File System Hierarchy The following commands create a file system named .Em pool/home and a file system named .Em pool/home/bob . The mount point .Pa /export/home is set for the parent file system, and is automatically inherited by the child file system. .Bd -literal # zfs create pool/home # zfs set mountpoint=/export/home pool/home # zfs create pool/home/bob .Ed .It Sy Example 2 No Creating a ZFS Snapshot The following command creates a snapshot named .Sy yesterday . This snapshot is mounted on demand in the .Pa .zfs/snapshot directory at the root of the .Em pool/home/bob file system. .Bd -literal # zfs snapshot pool/home/bob@yesterday .Ed .It Sy Example 3 No Creating and Destroying Multiple Snapshots The following command creates snapshots named .Sy yesterday of .Em pool/home 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. .Bd -literal # zfs snapshot -r pool/home@yesterday # zfs destroy -r pool/home@yesterday .Ed .It Sy Example 4 No Disabling and Enabling File System Compression The following command disables the .Sy compression property for all file systems under .Em pool/home . The next command explicitly enables .Sy compression for .Em pool/home/anne . .Bd -literal # zfs set compression=off pool/home # zfs set compression=on pool/home/anne .Ed .It Sy Example 5 No Listing ZFS Datasets The following command lists all active file systems and volumes in the system. Snapshots are displayed if the .Sy listsnaps property is .Sy on . The default is .Sy off . See .Xr zpool 8 for more information on pool properties. .Bd -literal # zfs list 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 .It Sy Example 6 No Setting a Quota on a ZFS File System The following command sets a quota of 50 Gbytes for .Em pool/home/bob . .Bd -literal # zfs set quota=50G pool/home/bob .Ed .It Sy Example 7 No Listing ZFS Properties The following command lists all properties for .Em pool/home/bob . .Bd -literal # zfs get all 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 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 - .Ed .Pp The following command gets a single property value. .Bd -literal # zfs get -H -o value compression pool/home/bob on .Ed The following command lists all properties with local settings for .Em pool/home/bob . .Bd -literal # zfs get -r -s local -o name,property,value all pool/home/bob NAME PROPERTY VALUE pool/home/bob quota 20G pool/home/bob compression on .Ed .It Sy Example 8 No Rolling Back a ZFS File System The following command reverts the contents of .Em pool/home/anne to the snapshot named .Sy yesterday , deleting all intermediate snapshots. .Bd -literal # zfs rollback -r pool/home/anne@yesterday .Ed .It Sy Example 9 No Creating a ZFS Clone The following command creates a writable file system whose initial contents are the same as .Em pool/home/bob@yesterday . .Bd -literal # zfs clone pool/home/bob@yesterday pool/clone .Ed .It Sy Example 10 No Promoting a ZFS Clone 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: .Bd -literal # zfs create pool/project/production populate /pool/project/production with data # zfs snapshot pool/project/production@today # zfs clone pool/project/production@today pool/project/beta make changes to /pool/project/beta and test them # zfs promote pool/project/beta # zfs rename pool/project/production pool/project/legacy # zfs rename pool/project/beta pool/project/production once the legacy version is no longer needed, it can be destroyed # zfs destroy pool/project/legacy .Ed .It Sy Example 11 No Inheriting ZFS Properties The following command causes .Em pool/home/bob and .Em pool/home/anne to inherit the .Sy checksum property from their parent. .Bd -literal # zfs inherit checksum pool/home/bob pool/home/anne .Ed .It Sy Example 12 No Remotely Replicating ZFS Data 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 . .Bd -literal # zfs send pool/fs@a | \e ssh host zfs receive poolB/received/fs@a # zfs send -i a pool/fs@b | \e ssh host zfs receive poolB/received/fs .Ed .It Sy Example 13 No Using the zfs receive -d Option The following command sends a full stream of .Em poolA/fsA/fsB@snap to a remote machine, receiving it into .Em poolB/received/fsA/fsB@snap . The .Em fsA/fsB@snap portion of the received snapshot's name is determined from the name of the sent snapshot. .Em poolB must contain the file system .Em poolB/received . If .Em poolB/received/fsA does not exist, it is created as an empty file system. .Bd -literal # zfs send poolA/fsA/fsB@snap | \e ssh host zfs receive -d poolB/received .Ed .It Sy Example 14 No Setting User Properties The following example sets the user-defined .Sy com.example:department property for a dataset. .Bd -literal # zfs set com.example:department=12345 tank/accounting .Ed .It Sy Example 15 No Performing a Rolling Snapshot 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: .Bd -literal # zfs destroy -r pool/users@7daysago # zfs rename -r pool/users@6daysago @7daysago # zfs rename -r pool/users@5daysago @6daysago # zfs rename -r pool/users@4daysago @5daysago # zfs rename -r pool/users@3daysago @4daysago # zfs rename -r pool/users@2daysago @3daysago # zfs rename -r pool/users@yesterday @2daysago # zfs rename -r pool/users@today @yesterday # zfs snapshot -r pool/users@today .Ed .It Sy Example 16 No Setting sharenfs Property Options on a ZFS File System The following commands show how to set .Sy sharenfs property options to enable .Sy rw access for a set of .Sy IP addresses and to enable root access for system .Sy neo on the .Em tank/home file system. .Bd -literal # zfs set sharenfs='rw=@123.123.0.0/16,root=neo' tank/home .Ed .Pp If you are using .Sy DNS for host name resolution, specify the fully qualified hostname. .It Sy Example 17 No Delegating ZFS Administration Permissions on a ZFS Dataset The following example shows how to set permissions so that user .Sy cindys can create, destroy, mount, and take snapshots on .Em tank/cindys . The permissions on .Em tank/cindys are also displayed. .Bd -literal # zfs allow cindys create,destroy,mount,snapshot tank/cindys # zfs allow tank/cindys ---- Permissions on tank/cindys -------------------------------------- Local+Descendent permissions: user cindys create,destroy,mount,snapshot .Ed .Pp Because the .Em tank/cindys mount point permission is set to 755 by default, user .Sy cindys will be unable to mount file systems under .Em tank/cindys . Add an ACE similar to the following syntax to provide mount point access: .Bd -literal # chmod A+user:cindys:add_subdirectory:allow /tank/cindys .Ed .It Sy Example 18 No Delegating Create Time Permissions on a ZFS Dataset The following example shows how to grant anyone in the group .Sy staff to create file systems in .Em tank/users . This syntax also allows staff members to destroy their own file systems, but not destroy anyone else's file system. The permissions on .Em tank/users are also displayed. .Bd -literal # zfs allow staff create,mount tank/users # zfs allow -c destroy tank/users # zfs allow tank/users ---- Permissions on tank/users --------------------------------------- Permission sets: destroy Local+Descendent permissions: group staff create,mount .Ed .It Sy Example 19 No Defining and Granting a Permission Set on a ZFS Dataset The following example shows how to define and grant a permission set on the .Em tank/users file system. The permissions on .Em tank/users are also displayed. .Bd -literal # zfs allow -s @pset create,destroy,snapshot,mount tank/users # zfs allow staff @pset tank/users # zfs allow tank/users ---- Permissions on tank/users --------------------------------------- Permission sets: @pset create,destroy,mount,snapshot Local+Descendent permissions: group staff @pset .Ed .It Sy Example 20 No Delegating Property Permissions on a ZFS Dataset The following example shows to grant the ability to set quotas and reservations on the .Em users/home file system. The permissions on .Em users/home are also displayed. .Bd -literal # zfs allow cindys quota,reservation users/home # zfs allow users/home ---- Permissions on users/home --------------------------------------- Local+Descendent permissions: user cindys quota,reservation 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 .It Sy Example 21 No Removing ZFS Delegated Permissions on a ZFS Dataset The following example shows how to remove the snapshot permission from the .Sy staff group on the .Em tank/users file system. The permissions on .Em tank/users are also displayed. .Bd -literal # zfs unallow staff snapshot tank/users # zfs allow tank/users ---- Permissions on tank/users --------------------------------------- Permission sets: @pset create,destroy,mount,snapshot Local+Descendent permissions: group staff @pset .Ed .It Sy 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 snapshot of a ZFS dataset and its current state. The .Fl F option is used to indicate type information for the files affected. .Bd -literal # zfs diff -F 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 .Ed .It Sy Example 23 No Creating a bookmark The following example create a bookmark to a snapshot. This bookmark can then be used instead of snapshot in send streams. .Bd -literal # zfs bookmark rpool@snapshot rpool#bookmark .Ed .It Sy Example 24 No Setting sharesmb Property Options on a ZFS File System The following example show how to share SMB filesystem through ZFS. Note that that a user and his/her password must be given. .Bd -literal # smbmount //127.0.0.1/share_tmp /mnt/tmp \\ -o user=workgroup/turbo,password=obrut,uid=1000 .Ed .Pp Minimal .Em /etc/samba/smb.conf configuration required: .Pp Samba will need to listen to 'localhost' (127.0.0.1) for the ZFS utilities to communicate with Samba. This is the default behavior for most Linux distributions. .Pp Samba must be able to authenticate a user. This can be done in a number of ways, depending on if using the system password file, LDAP or the Samba specific smbpasswd file. How to do this is outside the scope of this manual. Please refer to the .Xr smb.conf 5 man page for more information. .Pp See the .Sy USERSHARE section of the .Xr smb.conf 5 man page for all configuration options in case you need to modify any options to the share afterwards. Do note that any changes done with the .Xr net 8 command will be undone if the share is ever unshared (such as at a reboot etc). .El .Sh ENVIRONMENT VARIABLES .Bl -tag -width "ZFS_MOUNT_HELPER" .It Ev ZFS_MOUNT_HELPER Cause .Nm zfs mount to use .Em /bin/mount to mount zfs datasets. This option is provided for backwards compatibility with older zfs versions. .El .Sh INTERFACE STABILITY .Sy Committed . .Sh SEE ALSO .Xr attr 1 , .Xr gzip 1 , .Xr ssh 1 , .Xr chmod 2 , .Xr fsync 2 , .Xr stat 2 , .Xr write 2 , .Xr acl 5 , .Xr attributes 5 , .Xr exports 5 , .Xr exportfs 8 , .Xr mount 8 , .Xr net 8 , .Xr selinux 8 , +.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 , .Xr zfsconcepts 8 , .Xr zfsprops 8 , .Xr zpool 8 diff --git a/man/man8/zpool.8 b/man/man8/zpool.8 index 0fe6866f33da..7c12798da49c 100644 --- a/man/man8/zpool.8 +++ b/man/man8/zpool.8 @@ -1,568 +1,599 @@ .\" .\" 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 .\" or http://www.opensolaris.org/os/licensing. .\" 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) 2007, Sun Microsystems, Inc. All Rights Reserved. .\" Copyright (c) 2012, 2018 by Delphix. All rights reserved. .\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved. .\" Copyright (c) 2017 Datto Inc. .\" Copyright (c) 2018 George Melikov. All Rights Reserved. .\" Copyright 2017 Nexenta Systems, Inc. .\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved. .\" .Dd August 9, 2019 .Dt ZPOOL 8 .Os .Sh NAME .Nm zpool .Nd configure ZFS storage pools .Sh SYNOPSIS .Nm .Fl ?V .Nm .Cm version .Nm .Cm .Op Ar .Sh DESCRIPTION The .Nm command configures ZFS storage pools. A storage pool is a collection of devices that provides physical storage and data replication for ZFS datasets. All datasets within a storage pool share the same space. See .Xr zfs 8 for information on managing datasets. .Pp For an overview of creating and managing ZFS storage pools see the .Xr zpoolconcepts 8 manual page. .Sh SUBCOMMANDS All subcommands that modify state are logged persistently to the pool in their original form. .Pp The .Nm command provides subcommands to create and destroy storage pools, add capacity to storage pools, and provide information about the storage pools. The following subcommands are supported: .Bl -tag -width Ds .It Xo .Nm .Fl ? .Xc Displays a help message. .It Xo .Nm .Fl V, -version .Xc An alias for the .Nm zpool Cm version subcommand. .It Xo .Nm .Cm version .Xc Displays the software version of the .Nm userland utility and the zfs kernel module. .El .Ss Creation .Bl -tag -width Ds .It Xr zpool-create 8 Creates a new storage pool containing the virtual devices specified on the command line. .It Xr zpool-initialize 8 Begins initializing by writing to all unallocated regions on the specified devices, or all eligible devices in the pool if no individual devices are specified. .El .Ss Destruction .Bl -tag -width Ds .It Xr zpool-destroy 8 Destroys the given pool, freeing up any devices for other use. .It Xr zpool-labelclear 8 Removes ZFS label information from the specified .Ar device . .El .Ss Virtual Devices .Bl -tag -width Ds .It Xo .Xr zpool-attach 8 / .Xr zpool-detach 8 .Xc Increases or decreases redundancy by .Cm attach Ns -ing or .Cm detach Ns -ing a device on an existing vdev (virtual device). .It Xo .Xr zpool-add 8 / .Xr zpool-remove 8 .Xc Adds the specified virtual devices to the given pool, or removes the specified device from the pool. .It Xr zpool-replace 8 Replaces an existing device (which may be faulted) with a new one. .It Xr zpool-split 8 Creates a new pool by splitting all mirrors in an existing pool (which decreases its redundancy). .El .Ss Properties Available pool properties listed in the .Xr zpoolprops 8 manual page. .Bl -tag -width Ds .It Xr zpool-list 8 Lists the given pools along with a health status and space usage. .It Xo .Xr zpool-get 8 / .Xr zpool-set 8 .Xc Retrieves the given list of properties .Po or all properties if .Sy all is used .Pc for the specified storage pool(s). .El .Ss Monitoring .Bl -tag -width Ds .It Xr zpool-status 8 Displays the detailed health status for the given pools. .It Xr zpool-iostat 8 Displays logical I/O statistics for the given pools/vdevs. Physical I/Os may be observed via .Xr iostat 1 . .It Xr zpool-events 8 Lists all recent events generated by the ZFS kernel modules. These events are consumed by the .Xr zed 8 and used to automate administrative tasks such as replacing a failed device with a hot spare. For more information about the subclasses and event payloads that can be generated see the .Xr zfs-events 5 man page. .It Xr zpool-history 8 Displays the command history of the specified pool(s) or all pools if no pool is specified. .El .Ss Maintenance .Bl -tag -width Ds .It Xr zpool-scrub 8 Begins a scrub or resumes a paused scrub. .It Xr zpool-checkpoint 8 Checkpoints the current state of .Ar pool , which can be later restored by .Nm zpool Cm import --rewind-to-checkpoint . .It Xr zpool-trim 8 Initiates an immediate on-demand TRIM operation for all of the free space in a pool. This operation informs the underlying storage devices of all blocks in the pool which are no longer allocated and allows thinly provisioned devices to reclaim the space. .It Xr zpool-sync 8 This command forces all in-core dirty data to be written to the primary pool storage and not the ZIL. It will also update administrative information including quota reporting. Without arguments, .Sy zpool sync will sync all pools on the system. Otherwise, it will sync only the specified pool(s). .It Xr zpool-upgrade 8 Manage the on-disk format version of storage pools. .It Xr zpool-wait 8 Waits until all background activity of the given types has ceased in the given pool. .El .Ss Fault Resolution .Bl -tag -width Ds .It Xo .Xr zpool-offline 8 .Xr zpool-online 8 .Xc Takes the specified physical device offline or brings it online. .It Xr zpool-resilver 8 Starts a resilver. If an existing resilver is already running it will be restarted from the beginning. .It Xr zpool-reopen 8 Reopen all the vdevs associated with the pool. .It Xr zpool-clear 8 Clears device errors in a pool. .El .Ss Import & Export .Bl -tag -width Ds .It Xr zpool-import 8 Make disks containing ZFS storage pools available for use on the system. .It Xr zpool-export 8 Exports the given pools from the system. .It Xr zpool-reguid 8 Generates a new unique identifier for the pool. .El .Sh EXIT STATUS The following exit values are returned: .Bl -tag -width Ds .It Sy 0 Successful completion. .It Sy 1 An error occurred. .It Sy 2 Invalid command line options were specified. .El .Sh EXAMPLES .Bl -tag -width Ds .It Sy Example 1 No Creating a RAID-Z Storage Pool The following command creates a pool with a single raidz root vdev that consists of six disks. .Bd -literal # zpool create tank raidz sda sdb sdc sdd sde sdf .Ed .It Sy Example 2 No Creating a Mirrored Storage Pool The following command creates a pool with two mirrors, where each mirror contains two disks. .Bd -literal # zpool create tank mirror sda sdb mirror sdc sdd .Ed .It Sy Example 3 No Creating a ZFS Storage Pool by Using Partitions The following command creates an unmirrored pool using two disk partitions. .Bd -literal # zpool create tank sda1 sdb2 .Ed .It Sy Example 4 No Creating a ZFS Storage Pool by Using Files The following command creates an unmirrored pool using files. While not recommended, a pool based on files can be useful for experimental purposes. .Bd -literal # zpool create tank /path/to/file/a /path/to/file/b .Ed .It Sy Example 5 No Adding a Mirror to a ZFS Storage Pool The following command adds two mirrored disks to the pool .Em tank , assuming the pool is already made up of two-way mirrors. The additional space is immediately available to any datasets within the pool. .Bd -literal # zpool add tank mirror sda sdb .Ed .It Sy Example 6 No Listing Available ZFS Storage Pools The following command lists all available pools on the system. In this case, the pool .Em zion is faulted due to a missing device. The results from this command are similar to the following: .Bd -literal # zpool list NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT rpool 19.9G 8.43G 11.4G - 33% 42% 1.00x ONLINE - tank 61.5G 20.0G 41.5G - 48% 32% 1.00x ONLINE - zion - - - - - - - FAULTED - .Ed .It Sy Example 7 No Destroying a ZFS Storage Pool The following command destroys the pool .Em tank and any datasets contained within. .Bd -literal # zpool destroy -f tank .Ed .It Sy Example 8 No Exporting a ZFS Storage Pool The following command exports the devices in pool .Em tank so that they can be relocated or later imported. .Bd -literal # zpool export tank .Ed .It Sy Example 9 No Importing a ZFS Storage Pool The following command displays available pools, and then imports the pool .Em tank for use on the system. The results from this command are similar to the following: .Bd -literal # zpool import pool: tank id: 15451357997522795478 state: ONLINE action: The pool can be imported using its name or numeric identifier. config: tank ONLINE mirror ONLINE sda ONLINE sdb ONLINE # zpool import tank .Ed .It Sy Example 10 No Upgrading All ZFS Storage Pools to the Current Version The following command upgrades all ZFS Storage pools to the current version of the software. .Bd -literal # zpool upgrade -a This system is currently running ZFS version 2. .Ed .It Sy Example 11 No Managing Hot Spares The following command creates a new pool with an available hot spare: .Bd -literal # zpool create tank mirror sda sdb spare sdc .Ed .Pp If one of the disks were to fail, the pool would be reduced to the degraded state. The failed device can be replaced using the following command: .Bd -literal # zpool replace tank sda sdd .Ed .Pp Once the data has been resilvered, the spare is automatically removed and is made available for use should another device fail. The hot spare can be permanently removed from the pool using the following command: .Bd -literal # zpool remove tank sdc .Ed .It Sy Example 12 No Creating a ZFS Pool with Mirrored Separate Intent Logs The following command creates a ZFS storage pool consisting of two, two-way mirrors and mirrored log devices: .Bd -literal # zpool create pool mirror sda sdb mirror sdc sdd log mirror \\ sde sdf .Ed .It Sy Example 13 No Adding Cache Devices to a ZFS Pool The following command adds two disks for use as cache devices to a ZFS storage pool: .Bd -literal # zpool add pool cache sdc sdd .Ed .Pp Once added, the cache devices gradually fill with content from main memory. Depending on the size of your cache devices, it could take over an hour for them to fill. Capacity and reads can be monitored using the .Cm iostat option as follows: .Bd -literal # zpool iostat -v pool 5 .Ed .It Sy Example 14 No Removing a Mirrored top-level (Log or Data) Device The following commands remove the mirrored log device .Sy mirror-2 and mirrored top-level data device .Sy mirror-1 . .Pp Given this configuration: .Bd -literal pool: tank state: ONLINE scrub: none requested config: NAME STATE READ WRITE CKSUM tank ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 sda ONLINE 0 0 0 sdb ONLINE 0 0 0 mirror-1 ONLINE 0 0 0 sdc ONLINE 0 0 0 sdd ONLINE 0 0 0 logs mirror-2 ONLINE 0 0 0 sde ONLINE 0 0 0 sdf ONLINE 0 0 0 .Ed .Pp The command to remove the mirrored log .Sy mirror-2 is: .Bd -literal # zpool remove tank mirror-2 .Ed .Pp The command to remove the mirrored data .Sy mirror-1 is: .Bd -literal # zpool remove tank mirror-1 .Ed .It Sy Example 15 No Displaying expanded space on a device The following command displays the detailed information for the pool .Em data . This pool is comprised of a single raidz vdev where one of its devices increased its capacity by 10GB. In this example, the pool will not be able to utilize this extra capacity until all the devices under the raidz vdev have been expanded. .Bd -literal # zpool list -v data NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT data 23.9G 14.6G 9.30G - 48% 61% 1.00x ONLINE - raidz1 23.9G 14.6G 9.30G - 48% sda - - - - - sdb - - - 10G - sdc - - - - - .Ed .It Sy Example 16 No Adding output columns Additional columns can be added to the .Nm zpool Cm status and .Nm zpool Cm iostat output with .Fl c option. .Bd -literal # zpool status -c vendor,model,size NAME STATE READ WRITE CKSUM vendor model size tank ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 U1 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T U10 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T U11 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T U12 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T U13 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T U14 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T # zpool iostat -vc size capacity operations bandwidth pool alloc free read write read write size ---------- ----- ----- ----- ----- ----- ----- ---- rpool 14.6G 54.9G 4 55 250K 2.69M sda1 14.6G 54.9G 4 55 250K 2.69M 70G ---------- ----- ----- ----- ----- ----- ----- ---- .Ed .El .Sh ENVIRONMENT VARIABLES .Bl -tag -width "ZFS_ABORT" .It Ev ZFS_ABORT Cause .Nm zpool to dump core on exit for the purposes of running .Sy ::findleaks . .El .Bl -tag -width "ZFS_COLOR" .It Ev ZFS_COLOR Use ANSI color in .Nm zpool status output. .El .Bl -tag -width "ZPOOL_IMPORT_PATH" .It Ev ZPOOL_IMPORT_PATH The search path for devices or files to use with the pool. This is a colon-separated list of directories in which .Nm zpool looks for device nodes and files. Similar to the .Fl d option in .Nm zpool import . .El .Bl -tag -width "ZPOOL_IMPORT_UDEV_TIMEOUT_MS" .It Ev ZPOOL_IMPORT_UDEV_TIMEOUT_MS The maximum time in milliseconds that .Nm zpool import will wait for an expected device to be available. .El .Bl -tag -width "ZPOOL_STATUS_NON_NATIVE_ASHIFT_IGNORE" .It Ev ZPOOL_STATUS_NON_NATIVE_ASHIFT_IGNORE If set, suppress warning about non-native vdev ashift in .Nm zpool status . The value is not used, only the presence or absence of the variable matters. .El .Bl -tag -width "ZPOOL_VDEV_NAME_GUID" .It Ev ZPOOL_VDEV_NAME_GUID Cause .Nm zpool subcommands to output vdev guids by default. This behavior is identical to the .Nm zpool status -g command line option. .El .Bl -tag -width "ZPOOL_VDEV_NAME_FOLLOW_LINKS" .It Ev ZPOOL_VDEV_NAME_FOLLOW_LINKS Cause .Nm zpool subcommands to follow links for vdev names by default. This behavior is identical to the .Nm zpool status -L command line option. .El .Bl -tag -width "ZPOOL_VDEV_NAME_PATH" .It Ev ZPOOL_VDEV_NAME_PATH Cause .Nm zpool subcommands to output full vdev path names by default. This behavior is identical to the .Nm zpool status -P command line option. .El .Bl -tag -width "ZFS_VDEV_DEVID_OPT_OUT" .It Ev ZFS_VDEV_DEVID_OPT_OUT Older ZFS on Linux implementations had issues when attempting to display pool config VDEV names if a .Sy devid NVP value is present in the pool's config. .Pp For example, a pool that originated on illumos platform would have a devid value in the config and .Nm zpool status would fail when listing the config. This would also be true for future Linux based pools. .Pp A pool can be stripped of any .Sy devid values on import or prevented from adding them on .Nm zpool create or .Nm zpool add by setting .Sy ZFS_VDEV_DEVID_OPT_OUT . .El .Bl -tag -width "ZPOOL_SCRIPTS_AS_ROOT" .It Ev ZPOOL_SCRIPTS_AS_ROOT Allow a privileged user to run the .Nm zpool status/iostat with the .Fl c option. Normally, only unprivileged users are allowed to run .Fl c . .El .Bl -tag -width "ZPOOL_SCRIPTS_PATH" .It Ev ZPOOL_SCRIPTS_PATH The search path for scripts when running .Nm zpool status/iostat with the .Fl c option. This is a colon-separated list of directories and overrides the default .Pa ~/.zpool.d and .Pa /etc/zfs/zpool.d search paths. .El .Bl -tag -width "ZPOOL_SCRIPTS_ENABLED" .It Ev ZPOOL_SCRIPTS_ENABLED Allow a user to run .Nm zpool status/iostat with the .Fl c option. If .Sy ZPOOL_SCRIPTS_ENABLED is not set, it is assumed that the user is allowed to run .Nm zpool status/iostat -c . .El .Sh INTERFACE STABILITY .Sy Evolving .Sh SEE ALSO -.Xr zpoolconcepts 8 , -.Xr zpoolprops 8 , .Xr zfs-events 5 , .Xr zfs-module-parameters 5 , .Xr zpool-features 5 , .Xr zed 8 , -.Xr zfs 8 +.Xr zfs 8 , +.Xr zpool-add 8 , +.Xr zpool-attach 8 , +.Xr zpool-checkpoint 8 , +.Xr zpool-clear 8 , +.Xr zpool-create 8 , +.Xr zpool-destroy 8 , +.Xr zpool-detach 8 , +.Xr zpool-events 8 , +.Xr zpool-export 8 , +.Xr zpool-get 8 , +.Xr zpool-history 8 , +.Xr zpool-import 8 , +.Xr zpool-initialize 8 , +.Xr zpool-iostat 8 , +.Xr zpool-labelclear 8 , +.Xr zpool-list 8 , +.Xr zpool-offline 8 , +.Xr zpool-online 8 , +.Xr zpool-reguid 8 , +.Xr zpool-remove 8 , +.Xr zpool-reopen 8 , +.Xr zpool-replace 8 , +.Xr zpool-resilver 8 , +.Xr zpool-scrub 8 , +.Xr zpool-set 8 , +.Xr zpool-split 8 , +.Xr zpool-status 8 , +.Xr zpool-sync 8 , +.Xr zpool-trim 8 , +.Xr zpool-upgrade 8 , +.Xr zpool-wait 8 , +.Xr zpoolconcepts 8 , +.Xr zpoolprops 8