zpoolconcepts

title: zpoolconcepts(7)

summary: overview of ZFS storage pools

text:
# zpoolconcepts(7)

## NAME
zpoolconcepts — overview of ZFS storage pools

## DESCRIPTION

### Virtual Devices (vdevs)
A "virtual device" describes a single device or a collection of devices organized according to certain performance and fault characteristics. The following virtual devices are supported:

disk

A block device, typically located under /dev. ZFS can use individual slices or partitions, though the recommended mode of operation is to use whole disks. A disk can be specified by a full path, or it can be a shorthand name (the relative portion of the path under /dev). A whole disk can be specified by omitting the slice or partition designation. For example, sda is equivalent to /dev/sda. When given a whole disk, ZFS automatically labels the disk, if necessary.

file

A regular file. The use of files as a backing store is strongly discouraged. It is designed primarily for experimental purposes, as the fault tolerance of a file is only as good as the file system on which it resides. A file must be specified by a full path.

mirror

A mirror of two or more devices. Data is replicated in an identical fashion across all components of a mirror. A mirror with N disks of size X can hold X bytes and can withstand N-1 devices failing without losing data.

raidz, raidz1, raidz2, raidz3

A variation on RAID-5 that allows for better distribution of parity and eliminates the RAID-5 "write hole" (in which data and parity become inconsistent after a power loss). Data and parity is striped across all disks within a raidz group. A raidz group can have single, double, or triple parity, meaning that the raidz group can sustain one, two, or three failures, respectively, without losing any data. The raidz1 vdev type specifies a single-parity raidz group; the raidz2 vdev type specifies a double-parity raidz group; and the raidz3 vdev type specifies a triple-parity raidz group. The raidz vdev type is an alias for raidz1.

A raidz group with N disks of size X with P parity disks can hold approximately (N-P)*X bytes and can withstand P devices failing without losing data. The minimum number of devices in a raidz group is one more than the number of parity disks. The recommended number is between 3 and 9 to help increase performance.

draid, draid1, draid2, draid3

A variant of raidz that provides integrated distributed hot spares which allows for faster resilvering while retaining the benefits of raidz. A dRAID vdev is constructed from multiple internal raidz groups, each with D data devices and P parity devices. These groups are distributed over all of the children in order to fully utilize the available disk performance. Unlike raidz, dRAID uses a fixed stripe width (padding as necessary with zeros) to allow fully sequential resilvering. This fixed stripe width significantly effects both usable capacity and IOPS. For example, with the default D=8 and 4kB disk sectors the minimum allocation size is 32kB. If using compression, this relatively large allocation size can reduce the effective compression ratio. When using ZFS volumes and dRAID, the default of the volblocksize property is increased to account for the allocation size. If a dRAID pool will hold a significant amount of small blocks, it is recommended to also add a mirrored special vdev to store those blocks.

In regards to I/O, performance is similar to raidz since for any read all D data disks must be accessed. Delivered random IOPS can be reasonably approximated as floor((N-S)/(D+P))*single_drive_IOPS.

Like raidzm a dRAID can have single-, double-, or triple-parity. The draid1, draid2, and draid3 types can be used to specify the parity level. The draid vdev type is an alias for draid1.

A dRAID with N disks of size X, D data disks per redundancy group, P parity level, and S distributed hot spares can hold approximately (N-S)*(D/(D+P))*X bytes and can withstand P devices failing without losing data.

draid[parity][:datad][:childrenc][:sparess]

A non-default dRAID configuration can be specified by appending one or more of the following optional arguments to the draid keyword: parity

The parity level (1-3).

data

The number of data devices per redundancy group. In general, a smaller value of D will increase IOPS, improve the compression ratio, and speed up resilvering at the expense of total usable capacity. Defaults to 8, unless N-P-S is less than 8.

children

The expected number of children. Useful as a cross-check when listing a large number of devices. An error is returned when the provided number of children differs.

spares

The number of distributed hot spares. Defaults to zero.

spare

A pseudo-vdev which keeps track of available hot spares for a pool. For more information, see the Hot Spares section.

log

A separate intent log device. If more than one log device is specified, then writes are load-balanced between devices. Log devices can be mirrored. However, raidz vdev types are not supported for the intent log. For more information, see the Intent Log section.

dedup

A device dedicated solely for deduplication tables. The redundancy of this device should match the redundancy of the other normal devices in the pool. If more than one dedup device is specified, then allocations are load-balanced between those devices.

special

A device dedicated solely for allocating various kinds of internal metadata, and optionally small file blocks. The redundancy of this device should match the redundancy of the other normal devices in the pool. If more than one special device is specified, then allocations are load-balanced between those devices. For more information on special allocations, see the Special Allocation Class section.

cache

A device used to cache storage pool data. A cache device cannot be configured as a mirror or raidz group. For more information, see the Cache Devices section.

Virtual devices cannot be nested, so a mirror or raidz virtual device can only contain files or disks. Mirrors of mirrors (or other combinations) are not allowed.

A pool can have any number of virtual devices at the top of the configuration (known as "root vdevs"). Data is dynamically distributed across all top-level devices to balance data among devices. As new virtual devices are added, ZFS automatically places data on the newly available devices.

Virtual devices are specified one at a time on the command line, separated by whitespace. Keywords like mirror and raidz are used to distinguish where a group ends and another begins. For example, the following creates a pool with two root vdevs, each a mirror of two disks:

\# zpool create mypool mirror sda sdb mirror sdc sdd

### Device Failure and Recovery
ZFS supports a rich set of mechanisms for handling device failure and data corruption. All metadata and data is checksummed, and ZFS automatically repairs bad data from a good copy when corruption is detected.

In order to take advantage of these features, a pool must make use of some form of redundancy, using either mirrored or raidz groups. While ZFS supports running in a non-redundant configuration, where each root vdev is simply a disk or file, this is strongly discouraged. A single case of bit corruption can render some or all of your data unavailable.

A pool's health status is described by one of three states: online, degraded, or faulted. An online pool has all devices operating normally. A degraded pool is one in which one or more devices have failed, but the data is still available due to a redundant configuration. A faulted pool has corrupted metadata, or one or more faulted devices, and insufficient replicas to continue functioning.

The health of the top-level vdev, such as a mirror or raidz device, is potentially impacted by the state of its associated vdevs, or component devices. A top-level vdev or component device is in one of the following states:

DEGRADED

One or more top-level vdevs is in the degraded state because one or more component devices are offline. Sufficient replicas exist to continue functioning. One or more component devices is in the degraded or faulted state, but sufficient replicas exist to continue functioning. The underlying conditions are as follows:

- The number of checksum errors exceeds acceptable levels and the device is degraded as an indication that something may be wrong. ZFS continues to use the device as necessary.

- The number of I/O errors exceeds acceptable levels. The device could not be marked as faulted because there are insufficient replicas to continue functioning.

FAULTED

One or more top-level vdevs is in the faulted state because one or more component devices are offline. Insufficient replicas exist to continue functioning. One or more component devices is in the faulted state, and insufficient replicas exist to continue functioning. The underlying conditions are as follows:

- The device could be opened, but the contents did not match expected values.

- The number of I/O errors exceeds acceptable levels and the device is faulted to prevent further use of the device.

OFFLINE

The device was explicitly taken offline by the zpool offline command.

ONLINE

The device is online and functioning.

REMOVED

The device was physically removed while the system was running. Device removal detection is hardware-dependent and may not be supported on all platforms.

UNAVAIL

The device could not be opened. If a pool is imported when a device was unavailable, then the device will be identified by a unique identifier instead of its path since the path was never correct in the first place.

Checksum errors represent events where a disk returned data that was expected to be correct, but was not. In other words, these are instances of silent data corruption. The checksum errors are reported in zpool status and zpool events. When a block is stored redundantly, a damaged block may be reconstructed (e.g. from raidz parity or a mirrored copy). In this case, ZFS reports the checksum error against the disks that contained damaged data. If a block is unable to be reconstructed (e.g. due to 3 disks being damaged in a raidz2 group), it is not possible to determine which disks were silently corrupted. In this case, checksum errors are reported for all disks on which the block is stored.

If a device is removed and later re-attached to the system, ZFS attempts online the device automatically. Device attachment detection is hardware-dependent and might not be supported on all platforms.

### Hot Spares
ZFS allows devices to be associated with pools as "hot spares". These devices are not actively used in the pool, but when an active device fails, it is automatically replaced by a hot spare. To create a pool with hot spares, specify a spare vdev with any number of devices. For example,

\# zpool create pool mirror sda sdb spare sdc sdd

Spares can be shared across multiple pools, and can be added with the zpool add command and removed with the zpool remove command. Once a spare replacement is initiated, a new spare vdev is created within the configuration that will remain there until the original device is replaced. At this point, the hot spare becomes available again if another device fails.

If a pool has a shared spare that is currently being used, the pool can not be exported since other pools may use this shared spare, which may lead to potential data corruption.

Shared spares add some risk. If the pools are imported on different hosts, and both pools suffer a device failure at the same time, both could attempt to use the spare at the same time. This may not be detected, resulting in data corruption.

An in-progress spare replacement can be cancelled by detaching the hot spare. If the original faulted device is detached, then the hot spare assumes its place in the configuration, and is removed from the spare list of all active pools.

The draid vdev type provides distributed hot spares. These hot spares are named after the dRAID vdev they're a part of (draid1-2-3 specifies spare 3 of vdev 2, which is a single parity dRAID) and may only be used by that dRAID vdev. Otherwise, they behave the same as normal hot spares.

Spares cannot replace log devices.

### Intent Log
The ZFS Intent Log (ZIL) satisfies POSIX requirements for synchronous transactions. For instance, databases often require their transactions to be on stable storage devices when returning from a system call. NFS and other applications can also use fsync(2) to ensure data stability. By default, the intent log is allocated from blocks within the main pool. However, it might be possible to get better performance using separate intent log devices such as NVRAM or a dedicated disk. For example:

\# zpool create pool sda sdb log sdc

Multiple log devices can also be specified, and they can be mirrored. See the EXAMPLES section for an example of mirroring multiple log devices.

Log devices can be added, replaced, attached, detached and removed. In addition, log devices are imported and exported as part of the pool that contains them. Mirrored devices can be removed by specifying the top-level mirror vdev.

### Cache Devices
Devices can be added to a storage pool as "cache devices". These devices provide an additional layer of caching between main memory and disk. For read-heavy workloads, where the working set size is much larger than what can be cached in main memory, using cache devices allows much more of this working set to be served from low latency media. Using cache devices provides the greatest performance improvement for random read-workloads of mostly static content.

To create a pool with cache devices, specify a cache vdev with any number of devices. For example:

\# zpool create pool sda sdb cache sdc sdd

Cache devices cannot be mirrored or part of a raidz configuration. If a read error is encountered on a cache device, that read I/O is reissued to the original storage pool device, which might be part of a mirrored or raidz configuration.

The content of the cache devices is persistent across reboots and restored asynchronously when importing the pool in L2ARC (persistent L2ARC). This can be disabled by setting l2arc_rebuild_enabled=0. For cache devices smaller than 1GB, we do not write the metadata structures required for rebuilding the L2ARC in order not to waste space. This can be changed with l2arc_rebuild_blocks_min_l2size. The cache device header (512B) is updated even if no metadata structures are written. Setting l2arc_headroom=0 will result in scanning the full-length ARC lists for cacheable content to be written in L2ARC (persistent ARC). If a cache device is added with zpool add its label and header will be overwritten and its contents are not going to be restored in L2ARC, even if the device was previously part of the pool. If a cache device is onlined with zpool online its contents will be restored in L2ARC. This is useful in case of memory pressure where the contents of the cache device are not fully restored in L2ARC. The user can off- and online the cache device when there is less memory pressure in order to fully restore its contents to L2ARC.

### Pool checkpoint
Before starting critical procedures that include destructive actions (like zfs destroy), an administrator can checkpoint the pool's state and in the case of a mistake or failure, rewind the entire pool back to the checkpoint. Otherwise, the checkpoint can be discarded when the procedure has completed successfully.

A pool checkpoint can be thought of as a pool-wide snapshot and should be used with care as it contains every part of the pool's state, from properties to vdev configuration. Thus, certain operations are not allowed while a pool has a checkpoint. Specifically, vdev removal/attach/detach, mirror splitting, and changing the pool's GUID. Adding a new vdev is supported, but in the case of a rewind it will have to be added again. Finally, users of this feature should keep in mind that scrubs in a pool that has a checkpoint do not repair checkpointed data.

To create a checkpoint for a pool:

\# zpool checkpoint pool

To later rewind to its checkpointed state, you need to first export it and then rewind it during import:

\# zpool export pool

\# zpool import --rewind-to-checkpoint pool

To discard the checkpoint from a pool:

\# zpool checkpoint -d pool

Dataset reservations (controlled by the reservation and refreservation properties) may be unenforceable while a checkpoint exists, because the checkpoint is allowed to consume the dataset's reservation. Finally, data that is part of the checkpoint but has been freed in the current state of the pool won't be scanned during a scrub.

### Special Allocation Class
Allocations in the special class are dedicated to specific block types. By default this includes all metadata, the indirect blocks of user data, and any deduplication tables. The class can also be provisioned to accept small file blocks.

A pool must always have at least one normal (non-dedup/-special) vdev before other devices can be assigned to the special class. If the special class becomes full, then allocations intended for it will spill back into the normal class.

Deduplication tables can be excluded from the special class by unsetting the zfs_ddt_data_is_special ZFS module parameter.

Inclusion of small file blocks in the special class is opt-in. Each dataset can control the size of small file blocks allowed in the special class by setting the special_small_blocks property to nonzero. See zfsprops(7) for more info on this property.


zpoolprops

package: zfs-utils

title: zpoolprops(7)

summary: properties of ZFS storage pools

text:
# zpoolprops(7)

## NAME
zpoolprops — properties of ZFS storage pools

## DESCRIPTION
Each pool has several properties associated with it. Some properties are read-only statistics while others are configurable and change the behavior of the pool.

The following are read-only properties:

allocated

Amount of storage used within the pool. See fragmentation and free for more information.

capacity

Percentage of pool space used. This property can also be referred to by its shortened column name, cap.

expandsize

Amount of uninitialized space within the pool or device that can be used to increase the total capacity of the pool. On whole-disk vdevs, this is the space beyond the end of the GPT – typically occurring when a LUN is dynamically expanded or a disk replaced with a larger one. On partition vdevs, this is the space appended to the partition after it was added to the pool – most likely by resizing it in-place. The space can be claimed for the pool by bringing it online with autoexpand=on or using zpool online -e.

fragmentation

The amount of fragmentation in the pool. As the amount of space allocated increases, it becomes more difficult to locate free space. This may result in lower write performance compared to pools with more unfragmented free space.

free

The amount of free space available in the pool. By contrast, the zfs(8) available property describes how much new data can be written to ZFS filesystems/volumes. The zpool free property is not generally useful for this purpose, and can be substantially more than the zfs available space. This discrepancy is due to several factors, including raidz parity; zfs reservation, quota, refreservation, and refquota properties; and space set aside by spa_slop_shift (see zfs(4) for more information).

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.

leaked

Space not released while freeing due to corruption, now permanently leaked into the pool.

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.

load_guid

A unique identifier for the pool. Unlike the guid property, this identifier is generated every time we load the pool (i.e. does not persist across imports/exports) and never changes while the pool is loaded (even if a reguid operation takes place).

size

Total size of the storage pool.

unsupported@guid

Information about unsupported features that are enabled on the pool. See zpool-features(7) for details.

The space usage properties report actual physical space available to the storage pool. The physical space can be different from the total amount of space that any contained datasets can actually use. The amount of space used in a raidz configuration depends on the characteristics of the data being written. In addition, ZFS reserves some space for internal accounting that the zfs(8) command takes into account, but the zpoolprops command does not. For non-full pools of a reasonable size, these effects should be invisible. For small pools, or pools that are close to being completely full, these discrepancies may become more noticeable.

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. This can be used when examining an unknown pool where the mount points cannot be trusted, or in an alternate boot environment, where the typical paths are not valid. altroot is not a persistent property. It is valid only while the system is up. Setting altroot defaults to using cachefile=none, though this may be overridden using an explicit setting.

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. This property can also be referred to by its shortened column name, rdonly.

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). Values from 9 to 16, inclusive, are valid; also, the value 0 (the default) means to auto-detect using the kernel's block layer and a ZFS internal exception list. I/O operations will be aligned to the specified size boundaries. Additionally, the minimum (disk) write size will be set to the specified size, so this represents a space vs. performance trade-off. For optimal performance, the pool sector size should be greater than or equal to the sector size of the underlying disks. The typical case for setting this property is when performance is important and the underlying disks use 4KiB sectors but report 512B sectors to the OS (for compatibility reasons); in that case, set ashift=12 (which is 1<<12 = 4096). When set, this property is used as the default hint value in subsequent vdev operations (add, attach and replace). Changing this value will not modify any existing vdev, not even on disk replacement; however it can be used, for instance, to replace a dying 512B sectors disk with a newer 4KiB sectors device: this will probably result in bad performance but at the same time could prevent loss of data.

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. If the device is part of a mirror or raidz then all devices within that mirror/raidz group must be expanded before the new space is made available to the pool. The default behavior is off. This property can also be referred to by its shortened column name, expand.

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. This property can also be referred to by its shortened column name, replace. Autoreplace can also be used with virtual disks (like device mapper) provided that you use the /dev/disk/by-vdev paths setup by vdev_id.conf. See the vdev_id(8) manual page for more details. Autoreplace and autoonline require the ZFS Event Daemon be configured and running. See the zed(8) manual page for more details.

autotrim=on|off

When set to on space which has been recently freed, and is no longer allocated by the pool, will be periodically trimmed. This allows block device vdevs which support BLKDISCARD, such as SSDs, or file vdevs on which the underlying file system supports hole-punching, to reclaim unused blocks. The default value for this property is off. Automatic TRIM does not immediately reclaim blocks after a free. Instead, it will optimistically delay allowing smaller ranges to be aggregated into a few larger ones. These can then be issued more efficiently to the storage. TRIM on L2ARC devices is enabled by setting l2arc_trim_ahead > 0.

Be aware that automatic trimming of recently freed data blocks can put significant stress on the underlying storage devices. This will vary depending of how well the specific device handles these commands. For lower-end devices it is often possible to achieve most of the benefits of automatic trimming by running an on-demand (manual) TRIM periodically using the zpool trim command.

bootfs=(unset)|pool[/dataset]

Identifies the default bootable dataset for the root pool. This property is expected to be set mainly by the installation and upgrade programs. Not all Linux distribution boot processes use the bootfs property.

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. All pools in this cache are automatically imported when the system boots. Some environments, such as install and clustering, need to cache this information in a different location so that pools are not automatically imported. Setting this property caches the pool configuration in a different location that can later be imported with zpool import -c. Setting it to the value none creates a temporary pool that is never cached, and the "" (empty string) uses the default location. Multiple pools can share the same cache file. Because the kernel destroys and recreates this file when pools are added and removed, care should be taken when attempting to access this file. When the last pool using a cachefile is exported or destroyed, the file will be empty.

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.

compatibility=off|legacy|file[,file]…

Specifies that the pool maintain compatibility with specific feature sets. When set to off (or unset) compatibility is disabled (all features may be enabled); when set to legacyno features may be enabled. When set to a comma-separated list of filenames (each filename may either be an absolute path, or relative to /etc/zfs/compatibility.d or /usr/share/zfs/compatibility.d) the lists of requested features are read from those files, separated by whitespace and/or commas. Only features present in all files may be enabled. See zpool-features(7), zpool-create(8) and zpool-upgrade(8) for more information on the operation of compatibility feature sets.

dedupditto=number

This property is deprecated and no longer has any effect.

delegation=on|off

Controls whether a non-privileged user is granted access based on the dataset permissions defined on the dataset. See zfs(8) for more information on ZFS delegated administration.

failmode=wait|continue|panic

Controls the system behavior in the event of catastrophic pool failure. This condition is typically a result of a loss of connectivity to the underlying storage device(s) or a failure of all devices within the pool. The behavior of such an event is determined as follows: wait

Blocks all I/O access until the device connectivity is recovered and the errors are cleared with zpool clear. This is the default behavior.

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. See zpool-features(7) for details on feature states.

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. This property can also be referred to by its shortened name, listsnaps.

multihost=on|off

Controls whether a pool activity check should be performed during zpool import. When a pool is determined to be active it cannot be imported, even with the -f option. This property is intended to be used in failover configurations where multiple hosts have access to a pool on shared storage. Multihost provides protection on import only. It does not protect against an individual device being used in multiple pools, regardless of the type of vdev. See the discussion under zpool create.

When this property is on, periodic writes to storage occur to show the pool is in use. See zfs_multihost_interval in the zfs(4) manual page. In order to enable this property each host must set a unique hostid. See genhostid(1) zgenhostid(8) spl(4) for additional details. The default value is off.

version=version

The current on-disk version of the pool. This can be increased, but never decreased. The preferred method of updating pools is with the zpool upgrade command, though this property can be used when a specific version is needed for backwards compatibility. Once feature flags are enabled on a pool this property will no longer have a value.