https://medium.com/@cq94/zfs-vous-connaissez-vous-devriez-1d2611e7dad6
TOC
chapter | designation |
---|---|
ADD | Adds the specified virtual devices to the given pool |
ATTACH | Attaches new_device to the existing device |
CLEAR | Clears device errors in a pool |
CREATE | Creates a new storage pool containing the virtual devices specified on the command line |
DESTROY | Destroys the given pool, freeing up any devices for other use |
DETACH | Detaches device from a mirror |
EVENTS | Lists all recent events generated by the ZFS kernel modules |
EXPORT | Exports the given pools from the system |
GET | Retrieves the given list of properties (or all properties if all is used) for the specified storage pool(s) |
HISTORY | Displays the command history of the specified pool(s) or all pools if no pool is specified |
IMPORT-LIST | Lists pools available to import |
IMPORT-ALL | Imports all pools found in the search directories |
IMPORT | Imports a specific pool |
IOSTAT | Displays I/O statistics for the given pools/vdevs |
LABELCLEAR | Removes ZFS label information from the specified device |
LIST | Lists the given pools along with a health status and space usage |
OFFLINE | Takes the specified physical device offline |
ONLINE | Brings the specified physical device online |
REGUID | Generates a new unique identifier for the pool |
REOPEN | Reopen all the vdevs associated with the pool |
REMOVE | Removes the specified device from the pool |
REPLACE | Replaces old_device with new_device |
SCRUB | Begins a scrub or resumes a paused scrub |
SET | Sets the given property on the specified pool |
SPLIT | Splits devices off pool creating newpool |
STATUS | Displays the detailed health status for the given pools |
UPGRADE-DISPLAY-NOT | Displays pools which do not have all supported features enabled and pools formatted using a legacy ZFS version number |
UPGRADE-DISPLAY | Displays legacy ZFS versions supported by the current software |
UPGRADE | Enables all supported features on the given pool |
PROPERTIES | Available propserties |
ADD
Adds the specified virtual devices to the given pool
The vdev specification is described in the Virtual Devices section. The behavior of the -f option, and the device checks performed are described in the zpool create subcommand
zpool add [-fgLnP] [-o property=value] pool vdev...
-f # Forces use of vdevs, even if they appear in use or specify a conflicting replication level
-g # Display vdev, GUIDs instead of the normal device names
-L # Display real paths for vdevs resolving all symbolic links
-n # Displays the configuration that would be used without actually adding the vdevs
-P # Display real paths for vdevs instead of only the last component of the path
-o property=value # Sets the given pool properties
ATTACH
Attaches new_device to the existing device
The existing device cannot be part of a raidz configuration. If device is not currently part of a mirrored configuration, device automatically transforms into a two-way mirror of device and new_device. If device is part of a two-way mirror, attaching new_device creates a three-way mirror, and so on. In either case, new_device begins to resilver immediately
zpool attach [-f] [-o property=value] pool device new_device
-f # Forces use of new_device, even if its appears to be in use
-o property=value # Sets the given pool properties
CLEAR
Clears device errors in a pool
If no arguments are specified, all device errors within the pool are cleared. If one or more devices is specified, only those errors associated with the specified device or devices are cleared
zpool clear pool [device]
CREATE
Creates a new storage pool containing the virtual devices specified on the command line
The pool name must begin with a letter, and can only contain alphanumeric characters as well as underscore ("_"), dash ("."), colon (":"),space ("-"), and period ("."). The pool names mirror, raidz, spare and log are reserved, as are names beginning with the pattern c[0-9]. The vdev specification is described in the Virtual Devices section
zpool create [-dfn] [-m mountpoint] [-o property=value]... [-o feature@feature=value]... [-O file-system-property=value]... [-R root] [-t tname] pool vdev...
-d # Do not enable any features on the new pool
-f # Forces use of vdevs, even if they appear in use or specify a conflicting replication level
-m mountpoint # Sets the mount point for the root dataset
-n # Displays the configuration that would be used without actually creating the pool
-o property=value # Sets the given pool properties
-o feature@feature=value # Sets the given pool feature
-O file-system-property=value # Sets the given file system properties in the root file system of the pool
-R root # Equivalent to -o cachefile=none -o altroot=root
-t tname # Sets the in-core pool name to tname while the on-disk name will be the name specified as the pool name pool
DESTROY
Destroys the given pool, freeing up any devices for other use
This command tries to unmount any active datasets before destroying the pool
zpool destroy [-f] pool
-f # Forces any active datasets contained within the pool to be unmounted
DETACH
Detaches device from a mirror
The operation is refused if there are no other valid replicas of the data
# Destroys the given pool, freeing up any devices for other use
zpool detach pool device
EVENTS
Lists all recent events generated by the ZFS kernel modules
These events are consumed by the 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 zfs-events(5) man page
zpool events
-c # Clear all previous events
-f # Follow mode
-H # Scripted mode. Do not display headers, and separate fields by a single tab instead of arbitrary space
-v # Print the entire payload for each event
EXPORT
Exports the given pools from the system
All devices are marked as exported, but are still considered in use by other subsystems. The devices can be moved between systems (even those of different endianness) and imported as long as a sufficient number of devices are present
zpool export [-a] [-f] pool...
-a # Exports all pools imported on the system
-f # Forcefully unmount all datasets, using the unmount -f command
GET
Retrieves the given list of properties (or all properties if all is used) for the specified storage pool(s)
These properties are displayed with the following fields:
- name Name of storage pool
- property Property name
- value Property value
- source Property source, either 'default' or 'local'
zpool get [-Hp] [-o field[,field]...] all|property[,property]... pool...
-H # Scripted mode. Do not display headers, and separate fields by a single tab instead of arbitrary space
-o field # A comma-separated list of columns to display. name,property,value,source is the default value
-p # Display numbers in parsable (exact) values
HISTORY
Displays the command history of the specified pool(s) or all pools if no pool is specified
zpool history [-il] [pool]...
-i # Displays internally logged ZFS events in addition to user initiated events
-l # Displays log records in long format: + user name, the hostname, and the zone
IMPORT-LIST
Lists pools available to import
zpool import [-D] [-c cachefile|-d dir]
-c cachefile # Reads configuration from the given cachefile that was created with the cachefile pool property
-d dir # Searches for devices or files in dir
-D # Lists destroyed pools only
IMPORT-ALL
Imports all pools found in the search directories
Identical to the previous command, except that all pools with a sufficient number of devices available are imported. Destroyed pools, pools that were previously destroyed with the zpool destroy command, will not be imported unless the -D option is specified
zpool import -a [-DfmN] [-F [-n] [-T] [-X]] [-c cachefile|-d dir] [-o mntopts] [-o property=value]... [-R root] [-s]
-a # Searches for and imports all pools found
-c cachefile # Reads configuration from the given cachefile that was created with the cachefile pool property
-d dir # Searches for devices or files in dir
-D # Imports destroyed pools only
-f # Forces import, even if the pool appears to be potentially active
-F # Recovery mode for a non-importable pool
-m # Allows a pool to import when there is a missing log device
-n # Used with the -F recovery option
-N # Import the pool without mounting any file systems
-o mntopts # Comma-separated list of mount options to use when mounting datasets within the pool
-o property=value # Sets the specified property on the imported pool
-R root # Sets the cachefile property to none and the altroot property to root
-s # Scan using the default search path, the libblkid cache will not be consulted
-X # Used with the -F recovery option
-T # Specify the txg to use for rollback
IMPORT
Imports a specific pool
A pool can be identified by its name or the numeric identifier. If newpool is specified, the pool is imported using the name newpool. Otherwise, it is imported with the same name as its exported name
zpool import [-Dfm] [-F [-n] [-t] [-T] [-X]] [-c cachefile|-d dir] [-o mntopts] [-o property=value]... [-R root] [-s] pool|id [newpool]
-c cachefile # Reads configuration from the given cachefile that was created with the cachefile pool property
-d dir Searches for devices or files in dir. The -d option can be specified multiple times. This option is incompatible with the -c option.
-D # Imports destroyed pool. The -f option is also required
-f # Forces import, even if the pool appears to be potentially active
-F # Recovery mode for a non-importable pool
-m # Allows a pool to import when there is a missing log device
-n # Used with the -F recovery option
-o mntopts # Comma-separated list of mount options to use when mounting datasets within the pool
-o property=value # Sets the specified property on the imported pool
-R root # Sets the cachefile property to none and the altroot property to root
-s # Scan using the default search path, the libblkid cache will not be consulted
-X # Used with the -F recovery option
-T # Specify the txg to use for rollback
-t # Used with newpool
IOSTAT
Displays I/O statistics for the given pools/vdevs
You can pass in a list of pools, a pool and list of vdevs in that pool, or a list of any vdevs from any pool. If no items are specified, statistics for every pool in the system are shown. When given an interval, the statistics are printed every interval seconds until ^C is pressed. If count is specified, the command exits after count reports are printed. The first report printed is always the statistics since boot regardless of whether interval and count are passed. However, this behavior can be suppressed with the -y flag. Also note that the units of K, M, ... that are printed in the report are in base 1024. To get the raw values, use the -p flag
zpool iostat [[[-c SCRIPT] [-lq]]|-rw] [-T u|d] [-ghHLpPvy] [[pool...]|[pool vdev...]|[vdev...]] [interval [count]]
-c [SCRIPT1[,SCRIPT2]...] # Run a script (or scripts) on each vdev and include the output as a new column in the zpool iostat output
-T u|d # Display a time stamp
-g # Display vdev GUIDs instead of the normal device names
-H # Scripted mode
-L # Display real paths for vdevs resolving all symbolic links
-p # Display numbers in parsable (exact) values
-P # Display full paths for vdevs instead of only the last component of the path
-r # Print request size histograms for the leaf ZIOs
-v # Verbose statistics Reports usage statistics for individual vdevs within the pool, in addition to the pool-wide statistics
-l # Include average latency statistics:
- total_wait: Average total IO time (queuing + disk IO time)
- disk_wait: Average disk IO time (time reading/writing the disk)
- syncq_wait: Average amount of time IO spent in synchronous priority queues. Does not include disk time
- asyncq_wait: Average amount of time IO spent in asynchronous priority queues. Does not include disk time
- scrub: Average queuing time in scrub queue. Does not include disk time
-q # Include active queue statistics
- syncq_read/write: Current number of entries in synchronous priority queues
- asyncq_read/write: Current number of entries in asynchronous priority queues
- scrubq_read: Current number of entries in scrub queue
LABELCLEAR
Removes ZFS label information from the specified device
The device must not be part of an active pool configuration
zpool labelclear [-f] device
-f # Treat exported or foreign devices as inactive
LIST
Lists the given pools along with a health status and space usage
If no pools are specified, all pools in the system are listed. When given an interval, the information is printed every interval seconds until ^C is pressed. If count is specified, the command exits after count reports are printed
zpool list [-HgLpPv] [-o property[,property]...] [-T u|d] [pool]... [interval [count]]
-g # print vdev GUIDs instead of the normal device names
-H # scripted mode. Do not display headers, and separate fields by a single tab instead of arbitrary space
-o property,... # print only specidied properties. Default list is name, size, alloc, free, fragmentation, expandsize, capacity, dedupratio, health, altroot
-L # Display real paths for vdevs resolving all symbolic links
-p # Display numbers in parsable (exact) values
-P # Display full paths for vdevs instead of only the last component of the path
-T u|d # Display a time stamp
-v # Verbose statistics
OFFLINE
Takes the specified physical device offline
While the device is offline, no attempt is made to read or write to the device. This command is not applicable to spares
zpool offline [-f] [-t] pool device...
-f # Force fault. Instead of offlining the disk, put it into a faulted state
-t # Temporary. Upon reboot, the specified physical device reverts to its previous state
ONLINE
Brings the specified physical device online
This command is not applicable to spares or cache devices
zpool online [-e] pool device...
-e # Expand the device to use all available space```
REGUID
Generates a new unique identifier for the pool
You must ensure that all devices in this pool are online and healthy before performing this action
zpool reguid pool
REOPEN
Reopen all the vdevs associated with the pool
zpool reopen pool
REMOVE
Removes the specified device from the pool
This command currently only supports removing hot spares, cache, and log devices. A mirrored log device can be removed by specifying the top-level mirror for the log. Non-log devices that are part of a mirrored configuration can be removed using the zpool detach command. Non-redundant and raidz devices cannot be removed from a pool
zpool remove pool device...
REPLACE
Replaces old_device with new_device
This is equivalent to attaching new_device, waiting for it to resilver, and then detaching old_device
The size of new_device must be greater than or equal to the minimum size of all the devices in a mirror or raidz configuration
zpool replace [-f] [-o property=value] pool device [new_device]
-f # Forces use of new_device, even if its appears to be in use
-o property=value # Sets the given pool properties. See the Properties section for a list of valid properties that can be set
SCRUB
Begins a scrub or resumes a paused scrub
The scrub examines all data in the specified pools to verify that it checksums correctly. For replicated (mirror or raidz) devices, ZFS automatically repairs any damage discovered during the scrub. The zpool status command reports the progress of the scrub and summarizes the results of the scrub upon completion
zpool scrub [-s | -p] pool...
-s # Stop scrubbing
-p # Pause scrubbing
SET
Sets the given property on the specified pool
zpool set property=value pool
SPLIT
Splits devices off pool creating newpool
All vdevs in pool must be mirrors and the pool must not be in the process of resilvering. At the time of the split, newpool will be a replica of pool. By default, the last device in each mirror is split from pool to create newpool
zpool split [-gLnP] [-o property=value]... [-R root] pool newpool [device ...]
-g # Display vdev GUIDs instead of the normal device names
-L # Display real paths for vdevs resolving all symbolic links
-n # Do dry run, do not actually perform the split
-P # Display full paths for vdevs instead of only the last component of the path
-o property=value # Sets the specified property for newpool
-R root # Set altroot for newpool to root and automatically import it
STATUS
Displays the detailed health status for the given pools
If no pool is specified, then the status of each pool in the system is displayed. For more information on pool and device health, see the Device Failure and Recovery section.
If a scrub or resilver is in progress, this command reports the percentage done and the estimated time to completion. Both of these are only approximate, because the amount of data in the pool and the other workloads on the system can change
zpool status [-c [SCRIPT1[,SCRIPT2]...]] [-gLPvxD] [-T u|d] [pool]... [interval [count]]
-c [SCRIPT1[,SCRIPT2]...] # Run a script (or scripts) on each vdev and include the output as a new column in the zpool status output
-g # Display vdev GUIDs instead of the normal device names
-L # Display real paths for vdevs resolving all symbolic links
-P # Display full paths for vdevs instead of only the last component of the path
-D # Display a histogram of deduplication statistics
-T u|d # Display a time stamp. -u for a the internal representation of time, -d for standard date format
-v # Displays verbose data error information, printing out a complete list of all data errors since the last complete pool scrub
-x # Only display status for pools that are exhibiting errors or are otherwise unavailable
UPGRADE-DISPLAY-NOT
Displays pools which do not have all supported features enabled and pools formatted using a legacy ZFS version number
These pools can continue to be used, but some features may not be available. Use zpool upgrade -a to enable all features on all pools
zpool upgrade
UPGRADE-DISPLAY
Displays legacy ZFS versions supported by the current software
See zpool-features(5) for a description of feature flags features supported by the current software
zpool upgrade -v
UPGRADE
Enables all supported features on the given pool
Once this is done, the pool will no longer be accessible on systems that do not support feature flags. See zfs-features(5) for details on compatibility with systems that support feature flags, but do not support all features enabled on the pool
zpool upgrade [-V version] -a|pool...
-a # Enables all supported features on all pools.
-V version # Upgrade to the specified legacy version. If the -V flag is specified, no features will be enabled on the pool
PROPERTIES
available # Amount of storage available within the pool
capacity # Percentage of pool space used
expandsize # Amount of uninitialized space within the pool or device that can be used to increase the total capacity of the pool
fragmentation # The amount of fragmentation in the pool
free # The amount of free space available in the pool
freeing # After a file system or snapshot is destroyed, the space it was using is returned to the pool asynchronously. freeing is the amount of space remaining to be reclaimed. Over time freeing will decrease while free increases
health # The current health of the pool. Health can be one of ONLINE, DEGRADED, FAULTED, OFFLINE, REMOVED, UNAVAIL
guid # A unique identifier for the pool
size # Total size of the storage pool
unsupported@feature_guid # Information about unsupported features that are enabled on the pool. See zpool-features(5) for details
used # Amount of storage space used within the pool
The following property can be set at creation time and import time:
altroot # Alternate root directory. If set, this directory is prepended to any mount points within the pool
The following property can be set only at import time:
readonly=on|off # If set to on, the pool will be imported in read-only mode
The following properties can be set at creation time and import time, and later changed with the zpool set command:
ashift=ashift # Pool sector size exponent, to the power of 2 (internally referred to as ashift )
autoexpand=on|off # Controls automatic pool expansion when the underlying LUN is grown. If set to on, the pool will be resized according to the size of the expanded device
autoreplace=on|off # Controls automatic device replacement. If set to off, device replacement must be initiated by the administrator by using the zpool replace command. If set to on, any new device, found in the same physical location as a device that previously belonged to the pool, is automatically formatted and replaced. The default behavior is off
bootfs=(unset)|pool/dataset # Identifies the default bootable dataset for the root pool
cachefile=path|none # Controls the location of where the pool configuration is cached. Discovering all pools on system startup requires a cached copy of the configuration data that is stored on the root file system
comment=text # A text string consisting of printable ASCII characters that will be stored such that it is available even if the pool becomes faulted. An administrator can provide additional information about a pool using this property
dedupditto=number # Threshold for the number of block ditto copies
delegation=on|off # Controls whether a non-privileged user is granted access based on the dataset permissions defined on the dataset
failmode=wait|continue|panic # Controls the system behavior in the event of catastrophic pool failure
wait # Blocks all I/O access until the device connectivity is recovered and the errors are cleared
continue # Returns EIO to any new write I/O requests but allows reads to any of the remaining healthy devices. Any write requests that have yet to be committed to disk would be blocked
panic # Prints out a message to the console and generates a system crash dump
feature@feature_name=enabled # The value of this property is the current state of feature_name. The only valid value when setting this property is enabled which moves feature_name to the enabled state
listsnapshots=on|off # Controls whether information about snapshots associated with this pool is output when zfs list is run without the -t option. The default value is off
version=version # The current on-disk version of the pool. This can be increased, but never decreased
https://medium.com/@cq94/zfs-vous-connaissez-vous-devriez-1d2611e7dad6
The zfs command configures ZFS datasets within a ZFS storage poo. A dataset is identified by a unique path within the ZFS namespace
A dataset can be one of the following:
- File system
A ZFS dataset of type filesystem can be mounted within the standard system namespace and behaves like other file systems - Volume
A logical volume exported as a raw or block device - Snapshot
A read-only version of a file system or volume at a given point in time. It is specified as filesystem@name or volume@name. - Bookmark
Much like a 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 filesystem#name or volume#name.
ZFS File System Hierarchy
A ZFS storage pool is a logical collection of devices that provide space for datasets. A storage pool is also the root of the ZFS file system hierarchy
- Snapshots
A snapshot is a read-only copy of a file system or volume - Bookmarks
A bookmark is like a snapshot, a read-only copy of a file system or volume. Bookmarks can be created extremely quickly, compared to snapshots, and they consume no additional space within the pool. Unlike snapshots, bookmarks can not be accessed through the filesystem in any way - Clones
A clone is a writable volume or file system whose initial contents are the same as another dataset. Clones can only be created from a snapshot. As with snapshots, creating a clone is nearly instantaneous, and initially consumes no additional space - Mount Points
Creating a ZFS file system is a simple operation, so the number of file systems per system is likely to be numerous - Deduplication
Deduplication is the process for removing redundant data at the block level, reducing the total amount of data stored
SUBCOMMANDS
subcommand | Designation |
---|---|
CREATE | Creates a new ZFS file system |
DESTROY | Destroys the given dataset |
SNAPSHOT | Creates snapshots with the given names |
ROLLBACK | Roll back the given dataset to a previous snapshot |
CLONE | Creates a clone of the given snapshot |
PROMOTE | Promotes a clone file system to no longer be dependent on its "origin" snapshot |
RENAME | Renames dataset |
LIST | Lists the property information for the given datasets in tabular form |
SET | Sets the property or list of properties to the given value(s) for each dataset |
GET | Displays properties for the given datasets |
INHERIT | Clears the specified property, causing it to be inherited from an ancestor |
USERSPACE | Displays space consumed by, and quotas on, each user in the specified filesystem or snapshot |
GROUPSPACE | Displays space consumed by, and quotas on, each group in the specified filesystem or snapshot |
MOUNT | Displays all ZFS file systems currently mounted or mounts it |
UNMOUNT | Unmounts currently mounted ZFS file systems |
SHARE | Shares available ZFS file systems |
UNSHARE | Unshares currently shared ZFS file systems |
BOOKMARK | Creates a bookmark of the given snapshot |
SEND | Creates a stream representation of the second snapshot |
RECEIVE | Creates a snapshot whose contents are as specified in the stream provided |
ALLOW | Displays permissions or Delegates ZFS administration permission for the file systems to non-privileged users |
UNALLOW | Removes permissions that were granted with the zfs allow command |
HOLD | Adds a single reference, named with the tag argument, to the specified snapshot or snapshots |
HOLDS | Lists all existing user references for the given snapshot or snapshots |
RELEASE | Removes a single reference, named with the tag argument, from the specified snapshot or snapshots |
DIFF | 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 |
PROPERTIES |
CREATE
Creates a new ZFS file system
zfs create [-p] [-o property=value]... filesystem # Creates a new ZFS file system. The file system is automatically mounted according to the mountpoint property inherited from the parent.
-o property=value # Sets the specified property as if the command zfs set property=value was invoked at the same time the dataset was created
-p # Creates all the non-existing parent datasets. Datasets created in this manner are automatically mounted according to the mountpoint property inherited from their parent.
Creates a volume of the given size
zfs create [-ps] [-b blocksize] [-o property=value]... -V size volume # Creates a volume of the given size. The volume is exported as a block device in /dev/zvol/path, where path is the name of the volume in the ZFS namespace
-b blocksize # Equivalent to -o volblocksize=blocksize
-o property=value # Sets the specified property as if the zfs set property=value command was invoked at the same time the dataset was created
-p # Creates all the non-existing parent datasets
-s # Creates a sparse volume with no reservation
examples
zfs create -o mountpoint=/var -o compression=lz4 $fs # create a filesytem with a mountpoint & compression options
zfs set quota=10G $fs # set a quota to user 'user'
zfs set compression=lz4 $fs# set lz4 compression for a fs
zfs set mountpoint=/var $fs # set mountpoint for a filesystem
DESTROY
Destroys the given dataset
zfs destroy [-Rfnprv] filesystem|volume
-R # Recursively destroy all dependents, including cloned file systems outside the target hierarchy.
-f # Force an unmount of any file systems using the unmount -f command
-n # Do a dry-run ("No-op") deletion. No data will be deleted
-p # Print machine-parsable verbose information about the deleted data
-r # Recursively destroy all children
-v # Print verbose information about the deleted data
Destroys the given snapshot
The given snapshots are destroyed immediately if and only if the zfs destroy command without the -d option would have destroyed it
zfs destroy [-Rdnprv] filesystem|volume@snap[%snap[,snap[%snap]]]...
-R # Recursively destroy all clones of these snapshots, including the clones, snapshots, and children. -d flag will have no effect
-d # Defer snapshot deletion.
-n # Do a dry-run ("No-op") deletion. No data will be deleted
-p # Print machine-parsable verbose information about the deleted data
-r # Destroy (or mark for deferred deletion) all snapshots with this name in descendent file systems
-v # Print verbose information about the deleted data
Destroys the given bookmark
zfs destroy filesystem|volume#bookmark
SNAPSHOT
Creates snapshots with the given names
zfs snapshot [-r] [-o property=value]... filesystem@snapname|volume@snapname...
-o property=value # Sets the specified property; see zfs create for details
-r # Recursively create snapshots of all descendent datasets
ROLLBACK
Roll back the given dataset to a previous snapshot
Roll back the given dataset to a previous snapshot. The -rR options do not recursively destroy the child snapshots of a recursive snapshot. Only direct snapshots of the specified filesystem are destroyed by either of these options. To completely roll back a recursive snapshot, you must rollback the individual child snapshots.
zfs rollback [-Rfr] snapshot
-R # Destroy any more recent snapshots and bookmarks, as well as any clones of those snapshots
-f # Used with the -R option to force an unmount of any clone file systems that are to be destroyed
-r # Destroy any snapshots and bookmarks more recent than the one specified
CLONE
Creates a clone of the given snapshot
zfs clone [-p] [-o property=value]... snapshot filesystem|volume
-o property=value # Sets the specified property
-p # Creates all the non-existing parent datasets. Datasets created in this manner are automatically mounted according to the mountpoint property inherited from their parent
PROMOTE
Promotes a clone file system to no longer be dependent on its "origin" snapshot
zfs promote clone-filesystem
RENAME
Renames dataset
Renames the given dataset. The new target can be located anywhere in the ZFS hierarchy, with the exception of snapshots. Snapshots can only be renamed within the parent file system or volume
zfs rename [-fp] filesystem|volume filesystem|volume
-f # Force unmount any filesystems that need to be unmounted in the process
-p # Creates all the nonexistent parent datasets. Datasets created in this manner are automatically mounted according to the mountpoint property inherited from their parent
Renames snapshot
Recursively rename the snapshots of all descendent datasets. Snapshots are the only dataset that can be renamed recursively
zfs rename -r snapshot snapshot
LIST
Lists the property information for the given datasets in tabular form
zfs list [-r|-d depth] [-Hp] [-o property[,property]...] [-s property]... [-S property]... [-t type[,type]...] [filesystem|volume|snapshot]...
-H # Used for scripting mode. Do not print headers and separate fields by a single tab instead of arbitrary white space
-S property # Same as the -s option, but sorts by property in descending order
-d depth # Recursively display any children of the dataset, limiting the recursion to depth
-o property # A comma-separated list of properties to display
-p # Display numbers in parsable (exact) values
-r # Recursively display any children of the dataset on the command line
-s property # A property for sorting the output by column in ascending order based on the value of the property
-t type # A comma-separated list of types to display, where type is one of filesystem, snapshot, volume, bookmark, or all
examples
zfs list -o name,used,available,readonly,exec,referenced,mountpoint,mounted,quota,clones
zfs list -t all -r $pool # print recursively space used by volumes
SET
Sets the property or list of properties to the given value(s) for each dataset. Only some properties can be edited
zfs set property=value [property=value]... filesystem|volume|snapshot...
GET
Displays properties for the given datasets
zfs get [-r|-d depth] [-Hp] [-o field[,field]...] [-s source[,source]...] [-t type[,type]...] all | property[,property]... filesystem|volume|snapshot|bookmark...
name Dataset name
property Property name
value Property value
source Property source. Can either be local, default, temporary, inherited, or none (-)
-H # Any headers are omitted, and fields are explicitly separated by a single tab instead of an arbitrary amount of space
-d depth # Recursively display any children of the dataset, limiting the recursion to depth
-o field # A comma-separated list of columns to display. name,property,value,source is the default value
-p # Display numbers in parsable (exact) values
-r # Recursively display properties for any children
-s source # A comma-separated list of sources to display
-t type # A comma-separated list of types to display, where type is one of filesystem, snapshot, volume, bookmark, or all
INHERIT
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 -S option reverted to the received value if one exists
zfs inherit [-rS] property filesystem|volume|snapshot...
-r # Recursively inherit the given property for all children
-S # Revert the property to the received value if one exists, otherwise operate as if the -S option was not specified
USERSPACE
Displays space consumed by, and quotas on, each user in the specified filesystem or snapshot. This corresponds to the userused@user, userobjused@user, userquota@user, and userobjquota@user properties.
zfs userspace [-Hinp] [-o field[,field]...] [-s field]... [-S field]... [-t type[,type]...] filesystem|snapshot
-H # Do not print headers, use tab-delimited output
-S field # Sort by this field in reverse order
-i # Translate SID to POSIX ID. The POSIX ID may be ephemeral if no mapping exists
-n # Print numeric ID instead of user/group name
-o field[,field]... # Display only the specified fields from the following set: type, name, used, quota. The default is to display all fields.
-p # Use exact (parsable) numeric output
-s field # Sort output by this field. The -s and -S flags may be specified multiple times to sort first by one field, then by another. The default is -s type -s name
-t # type[,type]... # Print only the specified types from the following set: all, posixuser, smbuser, posixgroup, smbgroup. The default is -t posixuser,smbuser. The default can be changed to include group types.
GROUPSPACE
Displays space consumed by, and quotas on, each group in the specified filesystem or snapshot
zfs groupspace [-Hinp] [-o field[,field]...] [-s field]... [-S field]... [-t type[,type]...] filesystem|snapshot
MOUNT
display
Displays all ZFS file systems currently mounted
zfs mount
mount
Mounts ZFS file systems
zfs mount [-Ov] [-o options] -a | filesystem
-O # Perform an overlay mount
-a # Mount all available ZFS file systems. Invoked automatically as part of the boot process
filesystem # Mount the specified filesystem
-o options # An optional, comma-separated list of mount options to use temporarily for the duration of the mount
-v # Report mount progress
UNMOUNT
Unmounts currently mounted ZFS file systems
zfs unmount [-f] -a | filesystem|mountpoint
-a # Unmount all available ZFS file systems
filesystem|mountpoint # Unmount the specified filesystem
-f # Forcefully unmount the file system, even if it is currently in use
SHARE
Shares available ZFS file systems
zfs share -a | filesystem
-a # Share all available ZFS file systems
filesystem # Share the specified filesystem according to the sharenfs and sharesmb properties
UNSHARE
Unshares currently shared ZFS file systems
zfs unshare -a | filesystem|mountpoint
-a # Unshare all available ZFS file systems
filesystem|mountpoint # Unshare the specified filesystem
BOOKMARK
Creates a bookmark of the given snapshot. Bookmarks mark the point in time when the snapshot was created, and can be used as the incremental source for a zfs send command
zfs bookmark snapshot bookmark
SEND
Creates a stream
Creates a stream representation of the second snapshot, which is written to standard output
zfs send [-DLPRcenpv] [[-I|-i] snapshot] snapshot
-D, --dedup # Generate a deduplicated stream. Blocks which would have been sent multiple times in the send stream will only be sent once. The receiving system must also support this feature to receive a dedu‐
plicated stream
-I snapshot # Generate a stream package that sends all intermediary snapshots from the first snapshot to the second snapshot
-L, --large-block # Generate a stream which may contain blocks larger than 128KB
-P, --parsable # Print machine-parsable verbose information about the stream package generated
-R, --replicate # Generate a replication stream package, which will replicate the specified file system, and all descendent file systems, up to the named snapshot
-e, --embed # Generate a more compact stream by using WRITE_EMBEDDED records for blocks which are stored more compactly on disk by the embedded_data pool feature
-c, --compressed # Generate a more compact stream by using compressed WRITE records for blocks which are compressed on disk and in memory
-i # snapshot # Generate an incremental stream from the first snapshot (the incremental source) to the second snapshot (the incremental target)
-n, --dryrun # Do a dry-run ("No-op") send
-p, --props # Include the dataset's properties in the stream
-v, --verbose # Print verbose information about the stream package generated
Generate a send stream
Generate a send stream, which may be of a filesystem, and may be incremental from a bookmark
zfs send [-Lce] [-i snapshot|bookmark] filesystem|volume|snapshot
-L, --large-block # Generate a stream which may contain blocks larger than 128KB
-c, --compressed # Generate a more compact stream by using compressed WRITE records for blocks which are compressed on disk and in memory
-e, --embed # Generate a more compact stream by using WRITE_EMBEDDED records for blocks which are stored more compactly on disk by the embedded_data pool feature
-i # snapshot|bookmark # Generate an incremental send stream
Generate a send stream
Creates a send stream which resumes an interrupted receive
zfs send [-Penv] -t receive_resume_token
RECEIVE
Creates a snapshot
Creates a snapshot whose contents are as specified in the stream provided on standard input
zfs receive [-Fnsuv] [-d|-e] [-o origin=snapshot] [-o property=value] [-x property] filesystem
-F # Force a rollback of the file system to the most recent snapshot before performing the receive operation
-d # Discard the first element of the sent snapshot's file system name
-e # Discard all but the last element of the sent snapshot's file system name
-n # Do not actually receive the stream
-o origin=snapshot # Forces the stream to be received as a clone of the given snapshot
-o property=value # Sets the specified property as if the command zfs set property=value was invoked immediately before the receive
-s # If the receive is interrupted, save the partially received state, rather than deleting it
-u # File system that is associated with the received stream is not mounted
-v # Print verbose information about the stream and the time required to perform the receive operation
-x property # Ensures that the effective value of the specified property after the receive is unaffected by the value of that property in the send stream (if any), as if the property had been excluded from the send stream
Abort an interrupted receive
Abort an interrupted zfs receive -s, deleting its saved partially received state
zfs receive -A filesystem|volume
ALLOW
Display
Displays permissions that have been delegated on the specified filesystem or volume
zfs allow filesystem|volume
Delegates permission
Delegates ZFS administration permission for the file systems to non-privileged users
zfs allow [-dglu] user|group[,user|group]... perm|@setname[,perm|@setname]... filesystem|volume zfs allow [-dl] -e|everyone perm|@setname[,perm|@setname]... filesystem|volume
-d # Allow only for the descendent file systems
-e|everyone # Specifies that the permissions be delegated to everyone
-g group[,group]... # Explicitly specify that permissions are delegated to the group
-l # Allow "locally" only for the specified file system
-u user[,user]... # Explicitly specify that permissions are delegated to the user
user|group[,user|group]... # Specifies to whom the permissions are delegated. Multiple entities can be specified as a comma-separated list
perm|@setname[,perm|@setname]... # The permissions to delegate. Multiple permissions may be specified as a comma-separated list. Permissions are generally the ability to use a ZFS subcommand or change a ZFS property
Available permissions
NAME TYPE NOTES
allow subcommand Must also have the permission that isbeing allowed
clone subcommand Must also have the 'create' ability and 'mount' ability in the origin file system
create subcommand Must also have the 'mount' ability
destroy subcommand Must also have the 'mount' ability
diff subcommand Allows lookup of paths within a dataset given an object number, and the ability to create snapshots necessary to 'zfs diff'
mount subcommand Allows mount/umount of ZFS datasets
promote subcommand Must also have the 'mount' and 'promote' ability in the origin file system
receive subcommand Must also have the 'mount' and 'create' ability
rename subcommand Must also have the 'mount' and 'create' ability in the new parent
rollback subcommand Must also have the 'mount' ability
send subcommand
share subcommand Allows sharing file systems over NFS or SMB protocols
snapshot subcommand Must also have the 'mount' ability
groupquota other Allows accessing any groupquota@... property
groupused other Allows reading any groupused@... property
userprop other Allows changing any user property
userquota other Allows accessing any userquota@... property
userused other Allows reading any userused@... property
aclinherit property
acltype property
atime property
canmount property
casesensitivity property
checksum property
compression property
copies property
devices property
exec property
filesystem_limit property
mountpoint property
nbmand property
normalization property
primarycache property
quota property
readonly property
recordsize property
refquota property
refreservation property
reservation property
secondarycache property
setuid property
sharenfs property
sharesmb property
snapdir property
snapshot_limit property
utf8only property
version property
volblocksize property
volsize property
vscan property
xattr property
zoned property
time permission
Sets "create time" permissions
zfs allow -c perm|@setname[,perm|@setname]... filesystem|volume
to a set
Defines or adds permissions to a permission set
zfs allow -s @setname perm|@setname[,perm|@setname]... filesystem|volume
UNALLOW
Removes permissions
Removes permissions that were granted with the zfs allow command. No permissions are explicitly denied, so other permissions granted are still in effect
zfs unallow [-dglru] user|group[,user|group]... [perm|@setname[,perm|@setname]...] filesystem|volume zfs unallow [-dlr] -e|everyone [perm|@setname[,perm|@setname]...] filesystem|volume zfs unallow [-r] -c
[perm|@setname[,perm|@setname]...] filesystem|volume
-r # Recursively remove the permissions from this file system and all descendents
from a set
Removes permissions from a permission set
zfs unallow [-r] -s @setname [perm|@setname[,perm|@setname]...] filesystem|volume
HOLD
Adds a single reference, named with the tag argument, to the specified snapshot or snapshots
zfs hold [-r] tag snapshot...
-r # Specifies that a hold with the given tag is applied recursively to the snapshots of all descendent file systems
HOLDS
Lists all existing user references for the given snapshot or snapshots
zfs holds [-r] snapshot...
-r # Lists the holds that are set on the named descendent snapshots, in addition to listing the holds on the named snapshot
RELEASE
Removes a single reference, named with the tag argument, from the specified snapshot or snapshots
zfs release [-r] tag snapshot...
-r # Recursively releases a hold with the given tag on the snapshots of all descendent file systems
DIFF
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
zfs diff [-FHt] snapshot snapshot|filesystem
-F # Display an indication of the type of file, in a manner similar to the - option of ls(1).
-F B Block device
-F C Character device
-F / Directory
-F > Door
-F | Named pipe
-F @ Symbolic link
-F P Event port
-F = Socket
-F F Regular file
-H # Give more parsable tab-separated output, without header lines and without arrows.
-t # Display the path's inode change time as the first column of output.
The types of change are:
- The path has been removed
+ The path has been created
M The path has been modified
R The path has been renamed
PROPERTIES
Properties are divided into two types, native and user properties. Native properties either export internal statistics or control ZFS behavior. In addition, native properties are either editable or read-only
available # The amount of space available to the dataset and all its children
compressratio # For non-snapshots, the compression ratio achieved for the used space of this dataset, expressed as a multiplier
createtxg # The transaction group (txg) in which the dataset was created
creation # The time this dataset was created
clones # For snapshots, this property is a comma-separated list of filesystems or volumes which are clones of this snapshot
defer_destroy # This property is on if the snapshot has been marked for deferred destroy by using the zfs destroy -d command
filesystem_count # The total number of filesystems and volumes that exist under this location in the dataset tree
guid # The 64 bit GUID of this dataset or bookmark which does not change over its entire lifetime
logicalreferenced # The amount of space that is "logically" accessible by this dataset
logicalused # The amount of space that is "logically" consumed by this dataset and all its descendents
mounted # For file systems, indicates whether the file system is currently mounted
origin # For cloned file systems or volumes, the snapshot from which the clone was created
receive_resume_token For filesystems or volumes which have saved partially-completed state from zfs receive -s, this opaque token can be provided to zfs send -t to resume and complete the zfs receive
referenced # The amount of data that is accessible by this dataset, which may or may not be shared with other datasets in the pool
refcompressratio # The compression ratio achieved for the referenced space of this dataset, expressed as a multiplier
snapshot_count # The total number of snapshots that exist under this location in the dataset tree
type # The type of dataset: filesystem, volume, or snapshot
used # The amount of space consumed by this dataset and all its descendents
usedby* # The usedby* properties decompose the used properties into the various reasons that space is used
usedbychildren # The amount of space used by children of this dataset, which would be freed if all the dataset s children were destroyed
usedbydataset # The amount of space used by this dataset itself
usedbyrefreservation The amount of space used by a refreservation set on this dataset
usedbysnapshots # The amount of space consumed by snapshots of this dataset
userused@user # The amount of space consumed by the specified user in this dataset
userobjused@user # The userobjused property is similar to userused but instead it counts the number of objects consumed by a user
userrefs # This property is set to the number of user holds on this snapshot
groupused@group # The amount of space consumed by the specified group in this dataset
groupobjused@group # The number of objects consumed by the specified group in this dataset
volblocksize # For volumes, specifies the block size of the volume
written # The amount of space referenced by this dataset
written@snapshot # The amount of referenced space written to this dataset since the specified snapshot
The following native properties can be used to change the behavior of a ZFS dataset
aclinherit=discard|noallow|restricted|passthrough|passthrough-x # Controls how ACEs are inherited when files and directories are created
acltype=off|noacl|posixacl # Controls whether ACLs are enabled and if so what type of ACL to use
atime=on|off # Controls whether the access time for files is updated when they are read
canmount=on|off|noauto # If this property is set to off, the file system cannot be mounted, and is ignored by zfs mount -a
checksum=on|off|fletcher2|fletcher4|sha256|noparity|sha512|skein|edonr # Controls the checksum used to verify data integrity
compression=on|off|gzip|gzip-N|lz4|lzjb|zle # Controls the compression algorithm used for this dataset
context=none|SELinux_User:SElinux_Role:Selinux_Type:Sensitivity_Level # This flag sets the SELinux context for all files in the file system under a mount point for that file system
fscontext=none|SELinux_User:SElinux_Role:Selinux_Type:Sensitivity_Level # This flag sets the SELinux context for the file system file system being mounted
defcontext=none|SELinux_User:SElinux_Role:Selinux_Type:Sensitivity_Level # This flag sets the SELinux default context for unlabeled files
rootcontext=none|SELinux_User:SElinux_Role:Selinux_Type:Sensitivity_Level # This flag sets the SELinux context for the root inode of the file system
copies=1|2|3 # Controls the number of copies of data stored for this dataset
devices=on|off # Controls whether device nodes can be opened on this file system
dnodesize=legacy|auto|1k|2k|4k|8k|16k # Specifies a compatibility mode or literal value for the size of dnodes in the file system.
exec=on|off # Controls whether processes can be executed from within this file system
filesystem_limit=count|none # Limits the number of filesystems and volumes that can exist under this point in the dataset tree
mountpoint=path|none|legacy # Controls the mount point used for this file system
nbmand=on|off # Controls whether the file system should be mounted with nbmand (Non Blocking mandatory locks)
overlay=off|on # Allow mounting on a busy directory or a directory which already contains files or directories
primarycache=all|none|metadata # Controls what is cached in the primary cache (ARC)
quota=size|none # Limits the amount of space a dataset and its descendents can consume
snapshot_limit=count|none # Limits the number of snapshots that can be created on a dataset and its descendents
userquota@user=size|none # Limits the amount of space consumed by the specified user
userobjquota@user=size|none # The userobjquota is similar to userquota but it limits the number of objects a user can create
groupquota@group=size|none # Limits the amount of space consumed by the specified group
groupobjquota@group=size|none # The groupobjquota is similar to groupquota but it limits number of objects a group can consume
readonly=on|off # Controls whether this dataset can be modified
recordsize=size # Specifies a suggested block size for files in the file system
redundant_metadata=all|most # Controls what types of metadata are stored redundantly
refquota=size|none # Limits the amount of space a dataset can consume
refreservation=size|none # The minimum amount of space guaranteed to a dataset, not including its descendents
relatime=on|off # Controls the manner in which the access time is updated when atime=on is set
reservation=size|none # The minimum amount of space guaranteed to a dataset and its descendants
secondarycache=all|none|metadata # Controls what is cached in the secondary cache (L2ARC)
setuid=on|off # Controls whether the setuid bit is respected for the file system
sharesmb=on|off|opts # Controls whether the file system is shared by using Samba USERSHARES and what options are to be used
sharenfs=on|off|opts # Controls whether the file system is shared via NFS, and what options are to be used
logbias=latency|throughput # Provide a hint to ZFS about handling of synchronous requests in this dataset
snapdev=hidden|visible # Controls whether the volume snapshot devices under /dev/zvol/<pool> are hidden or visible
snapdir=hidden|visible # Controls whether the .zfs directory is hidden or visible in the root of the file system as discussed in the Snapshots section
sync=standard|always|disabled # Controls the behavior of synchronous requests (e.g. fsync, O_DSYNC)
version=N|current # The on-disk version of this file system, which is independent of the pool version
volsize=size # For volumes, specifies the logical size of the volume
volmode=default|full|geom|dev|none # This property specifies how volumes should be exposed to the OS
vscan=on|off # Controls whether regular files should be scanned for viruses when a file is opened and closed
xattr=on|off|sa # Controls whether extended attributes are enabled for this file system
zoned=on|off # Controls whether the dataset is managed from a non-global zone
The following three properties cannot be changed after the file system is created, and therefore, should be set when the file system is created
If the properties are not set with the zfs create or zpool create commands, these properties are inherited from the parent dataset. If the parent dataset lacks these properties due to having been created prior to these features being supported, the new file system will have the default values for these properties.
casesensitivity=sensitive|insensitive|mixed # Indicates whether the file name matching algorithm used by the file system should be case-sensitive, case-insensitive, or allow a combination of both styles of matching
normalization=none|formC|formD|formKC|formKD # Indicates whether the file system should perform a unicode normalization of file names whenever two file names are compared, and which normalization algorithm should be used
utf8only=on|off # Indicates whether the file system should reject file names that include characters that are not present in the UTF-8 character code set