]> git.proxmox.com Git - mirror_zfs.git/blame - man/man8/zpool.8
OpenZFS 8898 - creating fs with checksum=skein on the boot pools fails ungracefully
[mirror_zfs.git] / man / man8 / zpool.8
CommitLineData
cda0317e
GM
1.\"
2.\" CDDL HEADER START
3.\"
4.\" The contents of this file are subject to the terms of the
5.\" Common Development and Distribution License (the "License").
6.\" You may not use this file except in compliance with the License.
7.\"
8.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9.\" or http://www.opensolaris.org/os/licensing.
10.\" See the License for the specific language governing permissions
11.\" and limitations under the License.
12.\"
13.\" When distributing Covered Code, include this CDDL HEADER in each
14.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15.\" If applicable, add the following below this CDDL HEADER, with the
16.\" fields enclosed by brackets "[]" replaced with your own identifying
17.\" information: Portions Copyright [yyyy] [name of copyright owner]
18.\"
19.\" CDDL HEADER END
20.\"
21.\"
058ac9ba 22.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
f3a7f661 23.\" Copyright (c) 2013 by Delphix. All rights reserved.
df831108 24.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
bec1067d 25.\" Copyright (c) 2017 Datto Inc.
cda0317e 26.\" Copyright (c) 2017 George Melikov. All Rights Reserved.
d7323e79 27.\" Copyright 2017 Nexenta Systems, Inc.
d3f2cd7e 28.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
9ae529ec 29.\"
7c9abcf8 30.Dd August 23, 2017
cda0317e
GM
31.Dt ZPOOL 8 SMM
32.Os Linux
33.Sh NAME
34.Nm zpool
35.Nd configure ZFS storage pools
36.Sh SYNOPSIS
37.Nm
38.Fl ?
39.Nm
40.Cm add
41.Op Fl fgLnP
42.Oo Fl o Ar property Ns = Ns Ar value Oc
43.Ar pool vdev Ns ...
44.Nm
45.Cm attach
46.Op Fl f
47.Oo Fl o Ar property Ns = Ns Ar value Oc
48.Ar pool device new_device
49.Nm
50.Cm clear
51.Ar pool
52.Op Ar device
53.Nm
54.Cm create
55.Op Fl dfn
56.Op Fl m Ar mountpoint
57.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
58.Oo Fl o Ar feature@feature Ns = Ns Ar value Oc
59.Oo Fl O Ar file-system-property Ns = Ns Ar value Oc Ns ...
60.Op Fl R Ar root
61.Ar pool vdev Ns ...
62.Nm
63.Cm destroy
64.Op Fl f
65.Ar pool
66.Nm
67.Cm detach
68.Ar pool device
69.Nm
70.Cm events
88f9c939 71.Op Fl vHf Oo Ar pool Oc | Fl c
cda0317e
GM
72.Nm
73.Cm export
74.Op Fl a
75.Op Fl f
76.Ar pool Ns ...
77.Nm
78.Cm get
79.Op Fl Hp
80.Op Fl o Ar field Ns Oo , Ns Ar field Oc Ns ...
81.Sy all Ns | Ns Ar property Ns Oo , Ns Ar property Oc Ns ...
82.Ar pool Ns ...
83.Nm
84.Cm history
85.Op Fl il
86.Oo Ar pool Oc Ns ...
87.Nm
88.Cm import
89.Op Fl D
7c9abcf8 90.Op Fl d Ar dir
cda0317e
GM
91.Nm
92.Cm import
93.Fl a
b5256303 94.Op Fl DflmN
cda0317e
GM
95.Op Fl F Oo Fl n Oc Oo Fl T Oc Oo Fl X Oc
96.Op Fl c Ar cachefile Ns | Ns Fl d Ar dir
97.Op Fl o Ar mntopts
98.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
99.Op Fl R Ar root
100.Nm
101.Cm import
b5256303 102.Op Fl Dflm
cda0317e
GM
103.Op Fl F Oo Fl n Oc Oo Fl T Oc Oo Fl X Oc
104.Op Fl c Ar cachefile Ns | Ns Fl d Ar dir
105.Op Fl o Ar mntopts
106.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
107.Op Fl R Ar root
108.Op Fl s
109.Ar pool Ns | Ns Ar id
110.Op Ar newpool Oo Fl t Oc
111.Nm
112.Cm iostat
113.Op Oo Oo Fl c Ar SCRIPT Oc Oo Fl lq Oc Oc Ns | Ns Fl rw
114.Op Fl T Sy u Ns | Ns Sy d
115.Op Fl ghHLpPvy
116.Oo Oo Ar pool Ns ... Oc Ns | Ns Oo Ar pool vdev Ns ... Oc Ns | Ns Oo Ar vdev Ns ... Oc Oc
117.Op Ar interval Op Ar count
118.Nm
119.Cm labelclear
120.Op Fl f
121.Ar device
122.Nm
123.Cm list
124.Op Fl HgLpPv
125.Op Fl o Ar property Ns Oo , Ns Ar property Oc Ns ...
126.Op Fl T Sy u Ns | Ns Sy d
127.Oo Ar pool Oc Ns ...
128.Op Ar interval Op Ar count
129.Nm
130.Cm offline
131.Op Fl f
132.Op Fl t
133.Ar pool Ar device Ns ...
134.Nm
135.Cm online
136.Op Fl e
137.Ar pool Ar device Ns ...
138.Nm
139.Cm reguid
140.Ar pool
141.Nm
142.Cm reopen
d3f2cd7e 143.Op Fl n
cda0317e
GM
144.Ar pool
145.Nm
146.Cm remove
147.Ar pool Ar device Ns ...
148.Nm
149.Cm replace
150.Op Fl f
151.Oo Fl o Ar property Ns = Ns Ar value Oc
152.Ar pool Ar device Op Ar new_device
153.Nm
154.Cm scrub
0ea05c64 155.Op Fl s | Fl p
cda0317e
GM
156.Ar pool Ns ...
157.Nm
158.Cm set
159.Ar property Ns = Ns Ar value
160.Ar pool
161.Nm
162.Cm split
b5256303 163.Op Fl gLlnP
cda0317e
GM
164.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
165.Op Fl R Ar root
166.Ar pool newpool
167.Oo Ar device Oc Ns ...
168.Nm
169.Cm status
170.Oo Fl c Ar SCRIPT Oc
171.Op Fl gLPvxD
172.Op Fl T Sy u Ns | Ns Sy d
173.Oo Ar pool Oc Ns ...
174.Op Ar interval Op Ar count
175.Nm
176.Cm sync
177.Oo Ar pool Oc Ns ...
178.Nm
179.Cm upgrade
180.Nm
181.Cm upgrade
182.Fl v
183.Nm
184.Cm upgrade
185.Op Fl V Ar version
186.Fl a Ns | Ns Ar pool Ns ...
187.Sh DESCRIPTION
188The
189.Nm
190command configures ZFS storage pools.
191A storage pool is a collection of devices that provides physical storage and
192data replication for ZFS datasets.
193All datasets within a storage pool share the same space.
194See
195.Xr zfs 8
196for information on managing datasets.
197.Ss Virtual Devices (vdevs)
198A "virtual device" describes a single device or a collection of devices
199organized according to certain performance and fault characteristics.
200The following virtual devices are supported:
201.Bl -tag -width Ds
202.It Sy disk
203A block device, typically located under
204.Pa /dev .
205ZFS can use individual slices or partitions, though the recommended mode of
206operation is to use whole disks.
207A disk can be specified by a full path, or it can be a shorthand name
208.Po the relative portion of the path under
209.Pa /dev
210.Pc .
211A whole disk can be specified by omitting the slice or partition designation.
212For example,
213.Pa sda
214is equivalent to
215.Pa /dev/sda .
216When given a whole disk, ZFS automatically labels the disk, if necessary.
217.It Sy file
218A regular file.
219The use of files as a backing store is strongly discouraged.
220It is designed primarily for experimental purposes, as the fault tolerance of a
221file is only as good as the file system of which it is a part.
222A file must be specified by a full path.
223.It Sy mirror
224A mirror of two or more devices.
225Data is replicated in an identical fashion across all components of a mirror.
226A mirror with N disks of size X can hold X bytes and can withstand (N-1) devices
227failing before data integrity is compromised.
228.It Sy raidz , raidz1 , raidz2 , raidz3
229A variation on RAID-5 that allows for better distribution of parity and
230eliminates the RAID-5
231.Qq write hole
232.Pq in which data and parity become inconsistent after a power loss .
233Data and parity is striped across all disks within a raidz group.
234.Pp
235A raidz group can have single-, double-, or triple-parity, meaning that the
236raidz group can sustain one, two, or three failures, respectively, without
237losing any data.
238The
239.Sy raidz1
240vdev type specifies a single-parity raidz group; the
241.Sy raidz2
242vdev type specifies a double-parity raidz group; and the
243.Sy raidz3
244vdev type specifies a triple-parity raidz group.
245The
246.Sy raidz
247vdev type is an alias for
248.Sy raidz1 .
249.Pp
250A raidz group with N disks of size X with P parity disks can hold approximately
251(N-P)*X bytes and can withstand P device(s) failing before data integrity is
252compromised.
253The minimum number of devices in a raidz group is one more than the number of
254parity disks.
255The recommended number is between 3 and 9 to help increase performance.
256.It Sy spare
257A special pseudo-vdev which keeps track of available hot spares for a pool.
258For more information, see the
259.Sx Hot Spares
260section.
261.It Sy log
262A separate intent log device.
263If more than one log device is specified, then writes are load-balanced between
264devices.
265Log devices can be mirrored.
266However, raidz vdev types are not supported for the intent log.
267For more information, see the
268.Sx Intent Log
269section.
270.It Sy cache
271A device used to cache storage pool data.
272A cache device cannot be configured as a mirror or raidz group.
273For more information, see the
274.Sx Cache Devices
275section.
276.El
277.Pp
278Virtual devices cannot be nested, so a mirror or raidz virtual device can only
279contain files or disks.
280Mirrors of mirrors
281.Pq or other combinations
282are not allowed.
283.Pp
284A pool can have any number of virtual devices at the top of the configuration
285.Po known as
286.Qq root vdevs
287.Pc .
288Data is dynamically distributed across all top-level devices to balance data
289among devices.
290As new virtual devices are added, ZFS automatically places data on the newly
291available devices.
292.Pp
293Virtual devices are specified one at a time on the command line, separated by
294whitespace.
295The keywords
296.Sy mirror
297and
298.Sy raidz
299are used to distinguish where a group ends and another begins.
300For example, the following creates two root vdevs, each a mirror of two disks:
301.Bd -literal
302# zpool create mypool mirror sda sdb mirror sdc sdd
303.Ed
304.Ss Device Failure and Recovery
305ZFS supports a rich set of mechanisms for handling device failure and data
306corruption.
307All metadata and data is checksummed, and ZFS automatically repairs bad data
308from a good copy when corruption is detected.
309.Pp
310In order to take advantage of these features, a pool must make use of some form
311of redundancy, using either mirrored or raidz groups.
312While ZFS supports running in a non-redundant configuration, where each root
313vdev is simply a disk or file, this is strongly discouraged.
314A single case of bit corruption can render some or all of your data unavailable.
315.Pp
316A pool's health status is described by one of three states: online, degraded,
317or faulted.
318An online pool has all devices operating normally.
319A degraded pool is one in which one or more devices have failed, but the data is
320still available due to a redundant configuration.
321A faulted pool has corrupted metadata, or one or more faulted devices, and
322insufficient replicas to continue functioning.
323.Pp
324The health of the top-level vdev, such as mirror or raidz device, is
325potentially impacted by the state of its associated vdevs, or component
326devices.
327A top-level vdev or component device is in one of the following states:
328.Bl -tag -width "DEGRADED"
329.It Sy DEGRADED
330One or more top-level vdevs is in the degraded state because one or more
331component devices are offline.
332Sufficient replicas exist to continue functioning.
333.Pp
334One or more component devices is in the degraded or faulted state, but
335sufficient replicas exist to continue functioning.
336The underlying conditions are as follows:
337.Bl -bullet
338.It
339The number of checksum errors exceeds acceptable levels and the device is
340degraded as an indication that something may be wrong.
341ZFS continues to use the device as necessary.
342.It
343The number of I/O errors exceeds acceptable levels.
344The device could not be marked as faulted because there are insufficient
345replicas to continue functioning.
346.El
347.It Sy FAULTED
348One or more top-level vdevs is in the faulted state because one or more
349component devices are offline.
350Insufficient replicas exist to continue functioning.
351.Pp
352One or more component devices is in the faulted state, and insufficient
353replicas exist to continue functioning.
354The underlying conditions are as follows:
355.Bl -bullet
356.It
6b4e21c6 357The device could be opened, but the contents did not match expected values.
cda0317e
GM
358.It
359The number of I/O errors exceeds acceptable levels and the device is faulted to
360prevent further use of the device.
361.El
362.It Sy OFFLINE
363The device was explicitly taken offline by the
364.Nm zpool Cm offline
365command.
366.It Sy ONLINE
058ac9ba 367The device is online and functioning.
cda0317e
GM
368.It Sy REMOVED
369The device was physically removed while the system was running.
370Device removal detection is hardware-dependent and may not be supported on all
371platforms.
372.It Sy UNAVAIL
373The device could not be opened.
374If a pool is imported when a device was unavailable, then the device will be
375identified by a unique identifier instead of its path since the path was never
376correct in the first place.
377.El
378.Pp
379If a device is removed and later re-attached to the system, ZFS attempts
380to put the device online automatically.
381Device attach detection is hardware-dependent and might not be supported on all
382platforms.
383.Ss Hot Spares
384ZFS allows devices to be associated with pools as
385.Qq hot spares .
386These devices are not actively used in the pool, but when an active device
387fails, it is automatically replaced by a hot spare.
388To create a pool with hot spares, specify a
389.Sy spare
390vdev with any number of devices.
391For example,
392.Bd -literal
54e5f226 393# zpool create pool mirror sda sdb spare sdc sdd
cda0317e
GM
394.Ed
395.Pp
396Spares can be shared across multiple pools, and can be added with the
397.Nm zpool Cm add
398command and removed with the
399.Nm zpool Cm remove
400command.
401Once a spare replacement is initiated, a new
402.Sy spare
403vdev is created within the configuration that will remain there until the
404original device is replaced.
405At this point, the hot spare becomes available again if another device fails.
406.Pp
407If a pool has a shared spare that is currently being used, the pool can not be
408exported since other pools may use this shared spare, which may lead to
409potential data corruption.
410.Pp
7c9abcf8 411An in-progress spare replacement can be cancelled by detaching the hot spare.
cda0317e
GM
412If the original faulted device is detached, then the hot spare assumes its
413place in the configuration, and is removed from the spare list of all active
414pools.
415.Pp
058ac9ba 416Spares cannot replace log devices.
cda0317e
GM
417.Ss Intent Log
418The ZFS Intent Log (ZIL) satisfies POSIX requirements for synchronous
419transactions.
420For instance, databases often require their transactions to be on stable storage
421devices when returning from a system call.
422NFS and other applications can also use
423.Xr fsync 2
424to ensure data stability.
425By default, the intent log is allocated from blocks within the main pool.
426However, it might be possible to get better performance using separate intent
427log devices such as NVRAM or a dedicated disk.
428For example:
429.Bd -literal
430# zpool create pool sda sdb log sdc
431.Ed
432.Pp
433Multiple log devices can also be specified, and they can be mirrored.
434See the
435.Sx EXAMPLES
436section for an example of mirroring multiple log devices.
437.Pp
438Log devices can be added, replaced, attached, detached, and imported and
439exported as part of the larger pool.
440Mirrored log devices can be removed by specifying the top-level mirror for the
441log.
442.Ss Cache Devices
443Devices can be added to a storage pool as
444.Qq cache devices .
445These devices provide an additional layer of caching between main memory and
446disk.
447For read-heavy workloads, where the working set size is much larger than what
448can be cached in main memory, using cache devices allow much more of this
449working set to be served from low latency media.
450Using cache devices provides the greatest performance improvement for random
451read-workloads of mostly static content.
452.Pp
453To create a pool with cache devices, specify a
454.Sy cache
455vdev with any number of devices.
456For example:
457.Bd -literal
458# zpool create pool sda sdb cache sdc sdd
459.Ed
460.Pp
461Cache devices cannot be mirrored or part of a raidz configuration.
462If a read error is encountered on a cache device, that read I/O is reissued to
463the original storage pool device, which might be part of a mirrored or raidz
464configuration.
465.Pp
466The content of the cache devices is considered volatile, as is the case with
467other system caches.
468.Ss Properties
469Each pool has several properties associated with it.
470Some properties are read-only statistics while others are configurable and
471change the behavior of the pool.
472.Pp
473The following are read-only properties:
474.Bl -tag -width Ds
475.It Sy available
476Amount of storage available within the pool.
477This property can also be referred to by its shortened column name,
478.Sy avail .
479.It Sy capacity
480Percentage of pool space used.
481This property can also be referred to by its shortened column name,
482.Sy cap .
483.It Sy expandsize
9ae529ec 484Amount of uninitialized space within the pool or device that can be used to
cda0317e
GM
485increase the total capacity of the pool.
486Uninitialized space consists of any space on an EFI labeled vdev which has not
487been brought online
488.Po e.g, using
489.Nm zpool Cm online Fl e
490.Pc .
491This space occurs when a LUN is dynamically expanded.
492.It Sy fragmentation
f3a7f661 493The amount of fragmentation in the pool.
cda0317e 494.It Sy free
9ae529ec 495The amount of free space available in the pool.
cda0317e 496.It Sy freeing
9ae529ec 497After a file system or snapshot is destroyed, the space it was using is
cda0317e
GM
498returned to the pool asynchronously.
499.Sy freeing
500is the amount of space remaining to be reclaimed.
501Over time
502.Sy freeing
503will decrease while
504.Sy free
505increases.
506.It Sy health
507The current health of the pool.
508Health can be one of
509.Sy ONLINE , DEGRADED , FAULTED , OFFLINE, REMOVED , UNAVAIL .
510.It Sy guid
058ac9ba 511A unique identifier for the pool.
cda0317e 512.It Sy size
058ac9ba 513Total size of the storage pool.
cda0317e
GM
514.It Sy unsupported@ Ns Em feature_guid
515Information about unsupported features that are enabled on the pool.
516See
517.Xr zpool-features 5
518for details.
519.It Sy used
058ac9ba 520Amount of storage space used within the pool.
cda0317e
GM
521.El
522.Pp
523The space usage properties report actual physical space available to the
524storage pool.
525The physical space can be different from the total amount of space that any
526contained datasets can actually use.
527The amount of space used in a raidz configuration depends on the characteristics
528of the data being written.
529In addition, ZFS reserves some space for internal accounting that the
530.Xr zfs 8
531command takes into account, but the
532.Nm
533command does not.
534For non-full pools of a reasonable size, these effects should be invisible.
535For small pools, or pools that are close to being completely full, these
536discrepancies may become more noticeable.
537.Pp
058ac9ba 538The following property can be set at creation time and import time:
cda0317e
GM
539.Bl -tag -width Ds
540.It Sy altroot
541Alternate root directory.
542If set, this directory is prepended to any mount points within the pool.
543This can be used when examining an unknown pool where the mount points cannot be
544trusted, or in an alternate boot environment, where the typical paths are not
545valid.
546.Sy altroot
547is not a persistent property.
548It is valid only while the system is up.
549Setting
550.Sy altroot
551defaults to using
552.Sy cachefile Ns = Ns Sy none ,
553though this may be overridden using an explicit setting.
554.El
555.Pp
556The following property can be set only at import time:
557.Bl -tag -width Ds
558.It Sy readonly Ns = Ns Sy on Ns | Ns Sy off
559If set to
560.Sy on ,
561the pool will be imported in read-only mode.
562This property can also be referred to by its shortened column name,
563.Sy rdonly .
564.El
565.Pp
566The following properties can be set at creation time and import time, and later
567changed with the
568.Nm zpool Cm set
569command:
570.Bl -tag -width Ds
571.It Sy ashift Ns = Ns Sy ashift
572Pool sector size exponent, to the power of
573.Sy 2
574(internally referred to as
575.Sy ashift
576). Values from 9 to 16, inclusive, are valid; also, the special
577value 0 (the default) means to auto-detect using the kernel's block
578layer and a ZFS internal exception list. I/O operations will be aligned
579to the specified size boundaries. Additionally, the minimum (disk)
580write size will be set to the specified size, so this represents a
581space vs. performance trade-off. For optimal performance, the pool
582sector size should be greater than or equal to the sector size of the
583underlying disks. The typical case for setting this property is when
584performance is important and the underlying disks use 4KiB sectors but
585report 512B sectors to the OS (for compatibility reasons); in that
586case, set
587.Sy ashift=12
588(which is 1<<12 = 4096). When set, this property is
589used as the default hint value in subsequent vdev operations (add,
590attach and replace). Changing this value will not modify any existing
591vdev, not even on disk replacement; however it can be used, for
592instance, to replace a dying 512B sectors disk with a newer 4KiB
593sectors device: this will probably result in bad performance but at the
594same time could prevent loss of data.
595.It Sy autoexpand Ns = Ns Sy on Ns | Ns Sy off
596Controls automatic pool expansion when the underlying LUN is grown.
597If set to
598.Sy on ,
599the pool will be resized according to the size of the expanded device.
600If the device is part of a mirror or raidz then all devices within that
601mirror/raidz group must be expanded before the new space is made available to
602the pool.
603The default behavior is
604.Sy off .
605This property can also be referred to by its shortened column name,
606.Sy expand .
607.It Sy autoreplace Ns = Ns Sy on Ns | Ns Sy off
608Controls automatic device replacement.
609If set to
610.Sy off ,
611device replacement must be initiated by the administrator by using the
612.Nm zpool Cm replace
613command.
614If set to
615.Sy on ,
616any new device, found in the same physical location as a device that previously
617belonged to the pool, is automatically formatted and replaced.
618The default behavior is
619.Sy off .
620This property can also be referred to by its shortened column name,
621.Sy replace .
622Autoreplace can also be used with virtual disks (like device
623mapper) provided that you use the /dev/disk/by-vdev paths setup by
624vdev_id.conf. See the
625.Xr vdev_id 8
626man page for more details.
627Autoreplace and autoonline require the ZFS Event Daemon be configured and
628running. See the
629.Xr zed 8
630man page for more details.
631.It Sy bootfs Ns = Ns Sy (unset) Ns | Ns Ar pool Ns / Ns Ar dataset
632Identifies the default bootable dataset for the root pool. This property is
633expected to be set mainly by the installation and upgrade programs.
634Not all Linux distribution boot processes use the bootfs property.
635.It Sy cachefile Ns = Ns Ar path Ns | Ns Sy none
636Controls the location of where the pool configuration is cached.
637Discovering all pools on system startup requires a cached copy of the
638configuration data that is stored on the root file system.
639All pools in this cache are automatically imported when the system boots.
640Some environments, such as install and clustering, need to cache this
641information in a different location so that pools are not automatically
642imported.
643Setting this property caches the pool configuration in a different location that
644can later be imported with
645.Nm zpool Cm import Fl c .
646Setting it to the special value
647.Sy none
648creates a temporary pool that is never cached, and the special value
649.Qq
650.Pq empty string
651uses the default location.
652.Pp
653Multiple pools can share the same cache file.
654Because the kernel destroys and recreates this file when pools are added and
655removed, care should be taken when attempting to access this file.
656When the last pool using a
657.Sy cachefile
bbf1ad67 658is exported or destroyed, the file will be empty.
cda0317e
GM
659.It Sy comment Ns = Ns Ar text
660A text string consisting of printable ASCII characters that will be stored
661such that it is available even if the pool becomes faulted.
662An administrator can provide additional information about a pool using this
663property.
664.It Sy dedupditto Ns = Ns Ar number
665Threshold for the number of block ditto copies.
666If the reference count for a deduplicated block increases above this number, a
667new ditto copy of this block is automatically stored.
668The default setting is
669.Sy 0
670which causes no ditto copies to be created for deduplicated blocks.
671The minimum legal nonzero setting is
672.Sy 100 .
673.It Sy delegation Ns = Ns Sy on Ns | Ns Sy off
674Controls whether a non-privileged user is granted access based on the dataset
675permissions defined on the dataset.
676See
677.Xr zfs 8
678for more information on ZFS delegated administration.
679.It Sy failmode Ns = Ns Sy wait Ns | Ns Sy continue Ns | Ns Sy panic
680Controls the system behavior in the event of catastrophic pool failure.
681This condition is typically a result of a loss of connectivity to the underlying
682storage device(s) or a failure of all devices within the pool.
683The behavior of such an event is determined as follows:
684.Bl -tag -width "continue"
685.It Sy wait
686Blocks all I/O access until the device connectivity is recovered and the errors
687are cleared.
688This is the default behavior.
689.It Sy continue
690Returns
691.Er EIO
692to any new write I/O requests but allows reads to any of the remaining healthy
693devices.
694Any write requests that have yet to be committed to disk would be blocked.
695.It Sy panic
058ac9ba 696Prints out a message to the console and generates a system crash dump.
cda0317e
GM
697.El
698.It Sy feature@ Ns Ar feature_name Ns = Ns Sy enabled
699The value of this property is the current state of
700.Ar feature_name .
701The only valid value when setting this property is
702.Sy enabled
703which moves
704.Ar feature_name
705to the enabled state.
706See
707.Xr zpool-features 5
708for details on feature states.
709.It Sy listsnapshots Ns = Ns Sy on Ns | Ns Sy off
710Controls whether information about snapshots associated with this pool is
711output when
712.Nm zfs Cm list
713is run without the
714.Fl t
715option.
716The default value is
717.Sy off .
718This property can also be referred to by its shortened name,
719.Sy listsnaps .
379ca9cf
OF
720.It Sy multihost Ns = Ns Sy on Ns | Ns Sy off
721Controls whether a pool activity check should be performed during
722.Nm zpool Cm import .
723When a pool is determined to be active it cannot be imported, even with the
724.Fl f
725option. This property is intended to be used in failover configurations
726where multiple hosts have access to a pool on shared storage. When this
727property is on, periodic writes to storage occur to show the pool is in use.
728See
729.Sy zfs_multihost_interval
730in the
731.Xr zfs-module-parameters 5
732man page. In order to enable this property each host must set a unique hostid.
733See
734.Xr genhostid 1
b9373170 735.Xr zgenhostid 8
379ca9cf
OF
736.Xr spl-module-paramters 5
737for additional details. The default value is
738.Sy off .
cda0317e
GM
739.It Sy version Ns = Ns Ar version
740The current on-disk version of the pool.
741This can be increased, but never decreased.
742The preferred method of updating pools is with the
743.Nm zpool Cm upgrade
744command, though this property can be used when a specific version is needed for
745backwards compatibility.
746Once feature flags are enabled on a pool this property will no longer have a
747value.
748.El
749.Ss Subcommands
750All subcommands that modify state are logged persistently to the pool in their
751original form.
752.Pp
753The
754.Nm
755command provides subcommands to create and destroy storage pools, add capacity
756to storage pools, and provide information about the storage pools.
757The following subcommands are supported:
758.Bl -tag -width Ds
759.It Xo
760.Nm
761.Fl ?
762.Xc
058ac9ba 763Displays a help message.
cda0317e
GM
764.It Xo
765.Nm
766.Cm add
767.Op Fl fgLnP
768.Oo Fl o Ar property Ns = Ns Ar value Oc
769.Ar pool vdev Ns ...
770.Xc
771Adds the specified virtual devices to the given pool.
772The
773.Ar vdev
774specification is described in the
775.Sx Virtual Devices
776section.
777The behavior of the
778.Fl f
779option, and the device checks performed are described in the
780.Nm zpool Cm create
781subcommand.
782.Bl -tag -width Ds
783.It Fl f
784Forces use of
785.Ar vdev Ns s ,
786even if they appear in use or specify a conflicting replication level.
787Not all devices can be overridden in this manner.
788.It Fl g
789Display
790.Ar vdev ,
791GUIDs instead of the normal device names. These GUIDs can be used in place of
792device names for the zpool detach/offline/remove/replace commands.
793.It Fl L
794Display real paths for
795.Ar vdev Ns s
796resolving all symbolic links. This can be used to look up the current block
797device name regardless of the /dev/disk/ path used to open it.
798.It Fl n
799Displays the configuration that would be used without actually adding the
800.Ar vdev Ns s .
801The actual pool creation can still fail due to insufficient privileges or
802device sharing.
803.It Fl P
804Display real paths for
805.Ar vdev Ns s
806instead of only the last component of the path. This can be used in
807conjunction with the -L flag.
808.It Fl o Ar property Ns = Ns Ar value
809Sets the given pool properties. See the
810.Sx Properties
811section for a list of valid properties that can be set. The only property
812supported at the moment is ashift.
813.El
814.It Xo
815.Nm
816.Cm attach
817.Op Fl f
818.Oo Fl o Ar property Ns = Ns Ar value Oc
819.Ar pool device new_device
820.Xc
821Attaches
822.Ar new_device
823to the existing
824.Ar device .
825The existing device cannot be part of a raidz configuration.
826If
827.Ar device
828is not currently part of a mirrored configuration,
829.Ar device
830automatically transforms into a two-way mirror of
831.Ar device
832and
833.Ar new_device .
834If
835.Ar device
836is part of a two-way mirror, attaching
837.Ar new_device
838creates a three-way mirror, and so on.
839In either case,
840.Ar new_device
841begins to resilver immediately.
842.Bl -tag -width Ds
843.It Fl f
844Forces use of
845.Ar new_device ,
846even if its appears to be in use.
847Not all devices can be overridden in this manner.
848.It Fl o Ar property Ns = Ns Ar value
849Sets the given pool properties. See the
850.Sx Properties
851section for a list of valid properties that can be set. The only property
852supported at the moment is ashift.
853.El
854.It Xo
855.Nm
856.Cm clear
857.Ar pool
858.Op Ar device
859.Xc
860Clears device errors in a pool.
861If no arguments are specified, all device errors within the pool are cleared.
862If one or more devices is specified, only those errors associated with the
863specified device or devices are cleared.
864.It Xo
865.Nm
866.Cm create
867.Op Fl dfn
868.Op Fl m Ar mountpoint
869.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
870.Oo Fl o Ar feature@feature Ns = Ns Ar value Oc Ns ...
871.Oo Fl O Ar file-system-property Ns = Ns Ar value Oc Ns ...
872.Op Fl R Ar root
873.Op Fl t Ar tname
874.Ar pool vdev Ns ...
875.Xc
876Creates a new storage pool containing the virtual devices specified on the
877command line.
878The pool name must begin with a letter, and can only contain
879alphanumeric characters as well as underscore
880.Pq Qq Sy _ ,
881dash
90cdf283 882.Pq Qq Sy \&- ,
cda0317e
GM
883colon
884.Pq Qq Sy \&: ,
885space
90cdf283 886.Pq Qq Sy \&\ ,
cda0317e
GM
887and period
888.Pq Qq Sy \&. .
889The pool names
890.Sy mirror ,
891.Sy raidz ,
892.Sy spare
893and
894.Sy log
895are reserved, as are names beginning with the pattern
896.Sy c[0-9] .
897The
898.Ar vdev
899specification is described in the
900.Sx Virtual Devices
901section.
902.Pp
903The command verifies that each device specified is accessible and not currently
904in use by another subsystem.
905There are some uses, such as being currently mounted, or specified as the
906dedicated dump device, that prevents a device from ever being used by ZFS.
907Other uses, such as having a preexisting UFS file system, can be overridden with
908the
909.Fl f
910option.
911.Pp
912The command also checks that the replication strategy for the pool is
913consistent.
914An attempt to combine redundant and non-redundant storage in a single pool, or
915to mix disks and files, results in an error unless
916.Fl f
917is specified.
918The use of differently sized devices within a single raidz or mirror group is
919also flagged as an error unless
920.Fl f
921is specified.
922.Pp
923Unless the
924.Fl R
925option is specified, the default mount point is
926.Pa / Ns Ar pool .
927The mount point must not exist or must be empty, or else the root dataset
928cannot be mounted.
929This can be overridden with the
930.Fl m
931option.
932.Pp
933By default all supported features are enabled on the new pool unless the
934.Fl d
935option is specified.
936.Bl -tag -width Ds
937.It Fl d
938Do not enable any features on the new pool.
939Individual features can be enabled by setting their corresponding properties to
940.Sy enabled
941with the
942.Fl o
943option.
944See
945.Xr zpool-features 5
946for details about feature properties.
947.It Fl f
948Forces use of
949.Ar vdev Ns s ,
950even if they appear in use or specify a conflicting replication level.
951Not all devices can be overridden in this manner.
952.It Fl m Ar mountpoint
953Sets the mount point for the root dataset.
954The default mount point is
955.Pa /pool
956or
957.Pa altroot/pool
958if
959.Ar altroot
960is specified.
961The mount point must be an absolute path,
962.Sy legacy ,
963or
964.Sy none .
965For more information on dataset mount points, see
966.Xr zfs 8 .
967.It Fl n
968Displays the configuration that would be used without actually creating the
969pool.
970The actual pool creation can still fail due to insufficient privileges or
971device sharing.
972.It Fl o Ar property Ns = Ns Ar value
973Sets the given pool properties.
974See the
975.Sx Properties
976section for a list of valid properties that can be set.
977.It Fl o Ar feature@feature Ns = Ns Ar value
978Sets the given pool feature. See the
979.Xr zpool-features 5
980section for a list of valid features that can be set.
981Value can be either disabled or enabled.
982.It Fl O Ar file-system-property Ns = Ns Ar value
983Sets the given file system properties in the root file system of the pool.
984See the
985.Sx Properties
986section of
987.Xr zfs 8
988for a list of valid properties that can be set.
989.It Fl R Ar root
990Equivalent to
991.Fl o Sy cachefile Ns = Ns Sy none Fl o Sy altroot Ns = Ns Ar root
992.It Fl t Ar tname
993Sets the in-core pool name to
994.Sy tname
995while the on-disk name will be the name specified as the pool name
996.Sy pool .
997This will set the default cachefile property to none. This is intended
998to handle name space collisions when creating pools for other systems,
999such as virtual machines or physical machines whose pools live on network
1000block devices.
1001.El
1002.It Xo
1003.Nm
1004.Cm destroy
1005.Op Fl f
1006.Ar pool
1007.Xc
1008Destroys the given pool, freeing up any devices for other use.
1009This command tries to unmount any active datasets before destroying the pool.
1010.Bl -tag -width Ds
1011.It Fl f
058ac9ba 1012Forces any active datasets contained within the pool to be unmounted.
cda0317e
GM
1013.El
1014.It Xo
1015.Nm
1016.Cm detach
1017.Ar pool device
1018.Xc
1019Detaches
1020.Ar device
1021from a mirror.
1022The operation is refused if there are no other valid replicas of the data.
1023If device may be re-added to the pool later on then consider the
1024.Sy zpool offline
1025command instead.
1026.It Xo
1027.Nm
1028.Cm events
88f9c939 1029.Op Fl vHf Oo Ar pool Oc | Fl c
cda0317e
GM
1030.Xc
1031Lists all recent events generated by the ZFS kernel modules. These events
1032are consumed by the
1033.Xr zed 8
1034and used to automate administrative tasks such as replacing a failed device
1035with a hot spare. For more information about the subclasses and event payloads
1036that can be generated see the
1037.Xr zfs-events 5
1038man page.
1039.Bl -tag -width Ds
1040.It Fl c
d050c627 1041Clear all previous events.
cda0317e
GM
1042.It Fl f
1043Follow mode.
1044.It Fl H
1045Scripted mode. Do not display headers, and separate fields by a
1046single tab instead of arbitrary space.
1047.It Fl v
1048Print the entire payload for each event.
1049.El
1050.It Xo
1051.Nm
1052.Cm export
1053.Op Fl a
1054.Op Fl f
1055.Ar pool Ns ...
1056.Xc
1057Exports the given pools from the system.
1058All devices are marked as exported, but are still considered in use by other
1059subsystems.
1060The devices can be moved between systems
1061.Pq even those of different endianness
1062and imported as long as a sufficient number of devices are present.
1063.Pp
1064Before exporting the pool, all datasets within the pool are unmounted.
1065A pool can not be exported if it has a shared spare that is currently being
1066used.
1067.Pp
1068For pools to be portable, you must give the
1069.Nm
1070command whole disks, not just partitions, so that ZFS can label the disks with
1071portable EFI labels.
1072Otherwise, disk drivers on platforms of different endianness will not recognize
1073the disks.
1074.Bl -tag -width Ds
1075.It Fl a
859735c0 1076Exports all pools imported on the system.
cda0317e
GM
1077.It Fl f
1078Forcefully unmount all datasets, using the
1079.Nm unmount Fl f
1080command.
1081.Pp
1082This command will forcefully export the pool even if it has a shared spare that
1083is currently being used.
1084This may lead to potential data corruption.
1085.El
1086.It Xo
1087.Nm
1088.Cm get
1089.Op Fl Hp
1090.Op Fl o Ar field Ns Oo , Ns Ar field Oc Ns ...
1091.Sy all Ns | Ns Ar property Ns Oo , Ns Ar property Oc Ns ...
1092.Ar pool Ns ...
1093.Xc
1094Retrieves the given list of properties
1095.Po
1096or all properties if
1097.Sy all
1098is used
1099.Pc
1100for the specified storage pool(s).
1101These properties are displayed with the following fields:
1102.Bd -literal
2a8b84b7 1103 name Name of storage pool
058ac9ba
BB
1104 property Property name
1105 value Property value
1106 source Property source, either 'default' or 'local'.
cda0317e
GM
1107.Ed
1108.Pp
1109See the
1110.Sx Properties
1111section for more information on the available pool properties.
1112.Bl -tag -width Ds
1113.It Fl H
1114Scripted mode.
1115Do not display headers, and separate fields by a single tab instead of arbitrary
1116space.
1117.It Fl o Ar field
1118A comma-separated list of columns to display.
d7323e79 1119.Sy name Ns \&, Ns Sy property Ns \&, Ns Sy value Ns \&, Ns Sy source
2a8b84b7 1120is the default value.
cda0317e
GM
1121.It Fl p
1122Display numbers in parsable (exact) values.
1123.El
1124.It Xo
1125.Nm
1126.Cm history
1127.Op Fl il
1128.Oo Ar pool Oc Ns ...
1129.Xc
1130Displays the command history of the specified pool(s) or all pools if no pool is
1131specified.
1132.Bl -tag -width Ds
1133.It Fl i
1134Displays internally logged ZFS events in addition to user initiated events.
1135.It Fl l
1136Displays log records in long format, which in addition to standard format
1137includes, the user name, the hostname, and the zone in which the operation was
1138performed.
1139.El
1140.It Xo
1141.Nm
1142.Cm import
1143.Op Fl D
7c9abcf8 1144.Op Fl d Ar dir
cda0317e
GM
1145.Xc
1146Lists pools available to import.
1147If the
1148.Fl d
1149option is not specified, this command searches for devices in
1150.Pa /dev .
1151The
1152.Fl d
1153option can be specified multiple times, and all directories are searched.
1154If the device appears to be part of an exported pool, this command displays a
1155summary of the pool with the name of the pool, a numeric identifier, as well as
1156the vdev layout and current health of the device for each device or file.
1157Destroyed pools, pools that were previously destroyed with the
1158.Nm zpool Cm destroy
1159command, are not listed unless the
1160.Fl D
1161option is specified.
1162.Pp
1163The numeric identifier is unique, and can be used instead of the pool name when
1164multiple exported pools of the same name are available.
1165.Bl -tag -width Ds
1166.It Fl c Ar cachefile
1167Reads configuration from the given
1168.Ar cachefile
1169that was created with the
1170.Sy cachefile
1171pool property.
1172This
1173.Ar cachefile
1174is used instead of searching for devices.
1175.It Fl d Ar dir
1176Searches for devices or files in
1177.Ar dir .
1178The
1179.Fl d
1180option can be specified multiple times.
1181.It Fl D
058ac9ba 1182Lists destroyed pools only.
cda0317e
GM
1183.El
1184.It Xo
1185.Nm
1186.Cm import
1187.Fl a
b5256303 1188.Op Fl DflmN
cda0317e
GM
1189.Op Fl F Oo Fl n Oc Oo Fl T Oc Oo Fl X Oc
1190.Op Fl c Ar cachefile Ns | Ns Fl d Ar dir
1191.Op Fl o Ar mntopts
1192.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
1193.Op Fl R Ar root
1194.Op Fl s
1195.Xc
1196Imports all pools found in the search directories.
1197Identical to the previous command, except that all pools with a sufficient
1198number of devices available are imported.
1199Destroyed pools, pools that were previously destroyed with the
1200.Nm zpool Cm destroy
1201command, will not be imported unless the
1202.Fl D
1203option is specified.
1204.Bl -tag -width Ds
1205.It Fl a
6b4e21c6 1206Searches for and imports all pools found.
cda0317e
GM
1207.It Fl c Ar cachefile
1208Reads configuration from the given
1209.Ar cachefile
1210that was created with the
1211.Sy cachefile
1212pool property.
1213This
1214.Ar cachefile
1215is used instead of searching for devices.
1216.It Fl d Ar dir
1217Searches for devices or files in
1218.Ar dir .
1219The
1220.Fl d
1221option can be specified multiple times.
1222This option is incompatible with the
1223.Fl c
1224option.
1225.It Fl D
1226Imports destroyed pools only.
1227The
1228.Fl f
1229option is also required.
1230.It Fl f
1231Forces import, even if the pool appears to be potentially active.
1232.It Fl F
1233Recovery mode for a non-importable pool.
1234Attempt to return the pool to an importable state by discarding the last few
1235transactions.
1236Not all damaged pools can be recovered by using this option.
1237If successful, the data from the discarded transactions is irretrievably lost.
1238This option is ignored if the pool is importable or already imported.
b5256303
TC
1239.It Fl l
1240Indicates that this command will request encryption keys for all encrypted
1241datasets it attempts to mount as it is bringing the pool online. Note that if
1242any datasets have a
1243.Sy keylocation
1244of
1245.Sy prompt
1246this command will block waiting for the keys to be entered. Without this flag
1247encrypted datasets will be left unavailable until the keys are loaded.
cda0317e 1248.It Fl m
7f9d9946 1249Allows a pool to import when there is a missing log device.
cda0317e
GM
1250Recent transactions can be lost because the log device will be discarded.
1251.It Fl n
1252Used with the
1253.Fl F
1254recovery option.
1255Determines whether a non-importable pool can be made importable again, but does
1256not actually perform the pool recovery.
1257For more details about pool recovery mode, see the
1258.Fl F
1259option, above.
1260.It Fl N
7f9d9946 1261Import the pool without mounting any file systems.
cda0317e
GM
1262.It Fl o Ar mntopts
1263Comma-separated list of mount options to use when mounting datasets within the
1264pool.
1265See
1266.Xr zfs 8
1267for a description of dataset properties and mount options.
1268.It Fl o Ar property Ns = Ns Ar value
1269Sets the specified property on the imported pool.
1270See the
1271.Sx Properties
1272section for more information on the available pool properties.
1273.It Fl R Ar root
1274Sets the
1275.Sy cachefile
1276property to
1277.Sy none
1278and the
1279.Sy altroot
1280property to
1281.Ar root .
1282.It Fl s
1283Scan using the default search path, the libblkid cache will not be
1284consulted. A custom search path may be specified by setting the
1285ZPOOL_IMPORT_PATH environment variable.
1286.It Fl X
1287Used with the
1288.Fl F
1289recovery option. Determines whether extreme
1290measures to find a valid txg should take place. This allows the pool to
1291be rolled back to a txg which is no longer guaranteed to be consistent.
1292Pools imported at an inconsistent txg may contain uncorrectable
1293checksum errors. For more details about pool recovery mode, see the
1294.Fl F
1295option, above. WARNING: This option can be extremely hazardous to the
1296health of your pool and should only be used as a last resort.
1297.It Fl T
1298Specify the txg to use for rollback. Implies
1299.Fl FX .
1300For more details
1301about pool recovery mode, see the
1302.Fl X
1303option, above. WARNING: This option can be extremely hazardous to the
1304health of your pool and should only be used as a last resort.
1305.El
1306.It Xo
1307.Nm
1308.Cm import
b5256303 1309.Op Fl Dflm
cda0317e
GM
1310.Op Fl F Oo Fl n Oc Oo Fl t Oc Oo Fl T Oc Oo Fl X Oc
1311.Op Fl c Ar cachefile Ns | Ns Fl d Ar dir
1312.Op Fl o Ar mntopts
1313.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
1314.Op Fl R Ar root
1315.Op Fl s
1316.Ar pool Ns | Ns Ar id
1317.Op Ar newpool
1318.Xc
1319Imports a specific pool.
1320A pool can be identified by its name or the numeric identifier.
1321If
1322.Ar newpool
1323is specified, the pool is imported using the name
1324.Ar newpool .
1325Otherwise, it is imported with the same name as its exported name.
1326.Pp
1327If a device is removed from a system without running
1328.Nm zpool Cm export
1329first, the device appears as potentially active.
1330It cannot be determined if this was a failed export, or whether the device is
1331really in use from another host.
1332To import a pool in this state, the
1333.Fl f
1334option is required.
1335.Bl -tag -width Ds
1336.It Fl c Ar cachefile
1337Reads configuration from the given
1338.Ar cachefile
1339that was created with the
1340.Sy cachefile
1341pool property.
1342This
1343.Ar cachefile
1344is used instead of searching for devices.
1345.It Fl d Ar dir
1346Searches for devices or files in
1347.Ar dir .
1348The
1349.Fl d
1350option can be specified multiple times.
1351This option is incompatible with the
1352.Fl c
1353option.
1354.It Fl D
1355Imports destroyed pool.
1356The
1357.Fl f
1358option is also required.
1359.It Fl f
058ac9ba 1360Forces import, even if the pool appears to be potentially active.
cda0317e
GM
1361.It Fl F
1362Recovery mode for a non-importable pool.
1363Attempt to return the pool to an importable state by discarding the last few
1364transactions.
1365Not all damaged pools can be recovered by using this option.
1366If successful, the data from the discarded transactions is irretrievably lost.
1367This option is ignored if the pool is importable or already imported.
b5256303
TC
1368.It Fl l
1369Indicates that this command will request encryption keys for all encrypted
1370datasets it attempts to mount as it is bringing the pool online. Note that if
1371any datasets have a
1372.Sy keylocation
1373of
1374.Sy prompt
1375this command will block waiting for the keys to be entered. Without this flag
1376encrypted datasets will be left unavailable until the keys are loaded.
cda0317e 1377.It Fl m
7f9d9946 1378Allows a pool to import when there is a missing log device.
cda0317e
GM
1379Recent transactions can be lost because the log device will be discarded.
1380.It Fl n
1381Used with the
1382.Fl F
1383recovery option.
1384Determines whether a non-importable pool can be made importable again, but does
1385not actually perform the pool recovery.
1386For more details about pool recovery mode, see the
1387.Fl F
1388option, above.
1389.It Fl o Ar mntopts
1390Comma-separated list of mount options to use when mounting datasets within the
1391pool.
1392See
1393.Xr zfs 8
1394for a description of dataset properties and mount options.
1395.It Fl o Ar property Ns = Ns Ar value
1396Sets the specified property on the imported pool.
1397See the
1398.Sx Properties
1399section for more information on the available pool properties.
1400.It Fl R Ar root
1401Sets the
1402.Sy cachefile
1403property to
1404.Sy none
1405and the
1406.Sy altroot
1407property to
1408.Ar root .
1409.It Fl s
1410Scan using the default search path, the libblkid cache will not be
1411consulted. A custom search path may be specified by setting the
1412ZPOOL_IMPORT_PATH environment variable.
1413.It Fl X
1414Used with the
1415.Fl F
1416recovery option. Determines whether extreme
1417measures to find a valid txg should take place. This allows the pool to
1418be rolled back to a txg which is no longer guaranteed to be consistent.
1419Pools imported at an inconsistent txg may contain uncorrectable
1420checksum errors. For more details about pool recovery mode, see the
1421.Fl F
1422option, above. WARNING: This option can be extremely hazardous to the
1423health of your pool and should only be used as a last resort.
1424.It Fl T
1425Specify the txg to use for rollback. Implies
1426.Fl FX .
1427For more details
1428about pool recovery mode, see the
1429.Fl X
1430option, above. WARNING: This option can be extremely hazardous to the
1431health of your pool and should only be used as a last resort.
1c68856b 1432.It Fl t
cda0317e
GM
1433Used with
1434.Sy newpool .
1435Specifies that
1436.Sy newpool
1437is temporary. Temporary pool names last until export. Ensures that
1438the original pool name will be used in all label updates and therefore
1439is retained upon export.
1440Will also set -o cachefile=none when not explicitly specified.
1441.El
1442.It Xo
1443.Nm
1444.Cm iostat
1445.Op Oo Oo Fl c Ar SCRIPT Oc Oo Fl lq Oc Oc Ns | Ns Fl rw
1446.Op Fl T Sy u Ns | Ns Sy d
1447.Op Fl ghHLpPvy
1448.Oo Oo Ar pool Ns ... Oc Ns | Ns Oo Ar pool vdev Ns ... Oc Ns | Ns Oo Ar vdev Ns ... Oc Oc
1449.Op Ar interval Op Ar count
1450.Xc
1451Displays I/O statistics for the given pools/vdevs. You can pass in a
1452list of pools, a pool and list of vdevs in that pool, or a list of any
1453vdevs from any pool. If no items are specified, statistics for every
1454pool in the system are shown.
1455When given an
1456.Ar interval ,
1457the statistics are printed every
1458.Ar interval
1459seconds until ^C is pressed. If count is specified, the command exits
1460after count reports are printed. The first report printed is always
1461the statistics since boot regardless of whether
1462.Ar interval
1463and
1464.Ar count
1465are passed. However, this behavior can be suppressed with the
1466.Fl y
1467flag. Also note that the units of
1468.Sy K ,
1469.Sy M ,
1470.Sy G ...
1471that are printed in the report are in base 1024. To get the raw
1472values, use the
1473.Fl p
1474flag.
1475.Bl -tag -width Ds
7a8ed6b8 1476.It Fl c Op Ar SCRIPT1 Ns Oo , Ns Ar SCRIPT2 Oc Ns ...
cda0317e
GM
1477Run a script (or scripts) on each vdev and include the output as a new column
1478in the
1479.Nm zpool Cm iostat
1480output. Users can run any script found in their
1481.Pa ~/.zpool.d
1482directory or from the system
1483.Pa /etc/zfs/zpool.d
d6bcf7ff
GDN
1484directory. Script names containing the slash (/) character are not allowed.
1485The default search path can be overridden by setting the
cda0317e
GM
1486ZPOOL_SCRIPTS_PATH environment variable. A privileged user can run
1487.Fl c
1488if they have the ZPOOL_SCRIPTS_AS_ROOT
1489environment variable set. If a script requires the use of a privileged
1490command, like
7a8ed6b8
NB
1491.Xr smartctl 8 ,
1492then it's recommended you allow the user access to it in
cda0317e
GM
1493.Pa /etc/sudoers
1494or add the user to the
1495.Pa /etc/sudoers.d/zfs
1496file.
1497.Pp
1498If
1499.Fl c
1500is passed without a script name, it prints a list of all scripts.
1501.Fl c
7a8ed6b8 1502also sets verbose mode
90cdf283 1503.No \&( Ns Fl v Ns No \&).
cda0317e
GM
1504.Pp
1505Script output should be in the form of "name=value". The column name is
1506set to "name" and the value is set to "value". Multiple lines can be
1507used to output multiple columns. The first line of output not in the
1508"name=value" format is displayed without a column title, and no more
1509output after that is displayed. This can be useful for printing error
1510messages. Blank or NULL values are printed as a '-' to make output
1511awk-able.
1512.Pp
d6418de0 1513The following environment variables are set before running each script:
cda0317e
GM
1514.Bl -tag -width "VDEV_PATH"
1515.It Sy VDEV_PATH
1516Full path to the vdev
1517.El
1518.Bl -tag -width "VDEV_UPATH"
1519.It Sy VDEV_UPATH
1520Underlying path to the vdev (/dev/sd*). For use with device mapper,
1521multipath, or partitioned vdevs.
1522.El
1523.Bl -tag -width "VDEV_ENC_SYSFS_PATH"
1524.It Sy VDEV_ENC_SYSFS_PATH
1525The sysfs path to the enclosure for the vdev (if any).
1526.El
1527.It Fl T Sy u Ns | Ns Sy d
058ac9ba 1528Display a time stamp.
cda0317e
GM
1529Specify
1530.Sy u
1531for a printed representation of the internal representation of time.
1532See
1533.Xr time 2 .
1534Specify
1535.Sy d
1536for standard date format.
1537See
1538.Xr date 1 .
1539.It Fl g
1540Display vdev GUIDs instead of the normal device names. These GUIDs
1541can be used in place of device names for the zpool
1542detach/offline/remove/replace commands.
1543.It Fl H
1544Scripted mode. Do not display headers, and separate fields by a
1545single tab instead of arbitrary space.
1546.It Fl L
1547Display real paths for vdevs resolving all symbolic links. This can
1548be used to look up the current block device name regardless of the
1549.Pa /dev/disk/
1550path used to open it.
1551.It Fl p
1552Display numbers in parsable (exact) values. Time values are in
1553nanoseconds.
1554.It Fl P
1555Display full paths for vdevs instead of only the last component of
1556the path. This can be used in conjunction with the
1557.Fl L
1558flag.
1559.It Fl r
1560Print request size histograms for the leaf ZIOs. This includes
1561histograms of individual ZIOs (
1562.Ar ind )
1563and aggregate ZIOs (
1564.Ar agg ).
1565These stats can be useful for seeing how well the ZFS IO aggregator is
1566working. Do not confuse these request size stats with the block layer
1567requests; it's possible ZIOs can be broken up before being sent to the
1568block device.
1569.It Fl v
1570Verbose statistics Reports usage statistics for individual vdevs within the
1571pool, in addition to the pool-wide statistics.
1572.It Fl y
1573.It Fl w
1574.It Fl l
193a37cb 1575Include average latency statistics:
cda0317e
GM
1576.Pp
1577.Ar total_wait :
193a37cb 1578Average total IO time (queuing + disk IO time).
cda0317e 1579.Ar disk_wait :
193a37cb 1580Average disk IO time (time reading/writing the disk).
cda0317e
GM
1581.Ar syncq_wait :
1582Average amount of time IO spent in synchronous priority queues. Does
1583not include disk time.
1584.Ar asyncq_wait :
1585Average amount of time IO spent in asynchronous priority queues.
1586Does not include disk time.
1587.Ar scrub :
1588Average queuing time in scrub queue. Does not include disk time.
1589.It Fl q
1590Include active queue statistics. Each priority queue has both
1591pending (
1592.Ar pend )
1593and active (
1594.Ar activ )
1595IOs. Pending IOs are waiting to
1596be issued to the disk, and active IOs have been issued to disk and are
1597waiting for completion. These stats are broken out by priority queue:
1598.Pp
1599.Ar syncq_read/write :
1600Current number of entries in synchronous priority
1601queues.
1602.Ar asyncq_read/write :
193a37cb 1603Current number of entries in asynchronous priority queues.
cda0317e 1604.Ar scrubq_read :
193a37cb 1605Current number of entries in scrub queue.
cda0317e
GM
1606.Pp
1607All queue statistics are instantaneous measurements of the number of
1608entries in the queues. If you specify an interval, the measurements
1609will be sampled from the end of the interval.
1610.El
1611.It Xo
1612.Nm
1613.Cm labelclear
1614.Op Fl f
1615.Ar device
1616.Xc
1617Removes ZFS label information from the specified
1618.Ar device .
1619The
1620.Ar device
1621must not be part of an active pool configuration.
1622.Bl -tag -width Ds
1623.It Fl f
131cc95c 1624Treat exported or foreign devices as inactive.
cda0317e
GM
1625.El
1626.It Xo
1627.Nm
1628.Cm list
1629.Op Fl HgLpPv
1630.Op Fl o Ar property Ns Oo , Ns Ar property Oc Ns ...
1631.Op Fl T Sy u Ns | Ns Sy d
1632.Oo Ar pool Oc Ns ...
1633.Op Ar interval Op Ar count
1634.Xc
1635Lists the given pools along with a health status and space usage.
1636If no
1637.Ar pool Ns s
1638are specified, all pools in the system are listed.
1639When given an
1640.Ar interval ,
1641the information is printed every
1642.Ar interval
1643seconds until ^C is pressed.
1644If
1645.Ar count
1646is specified, the command exits after
1647.Ar count
1648reports are printed.
1649.Bl -tag -width Ds
1650.It Fl g
1651Display vdev GUIDs instead of the normal device names. These GUIDs
1652can be used in place of device names for the zpool
1653detach/offline/remove/replace commands.
1654.It Fl H
1655Scripted mode.
1656Do not display headers, and separate fields by a single tab instead of arbitrary
1657space.
1658.It Fl o Ar property
1659Comma-separated list of properties to display.
1660See the
1661.Sx Properties
1662section for a list of valid properties.
1663The default list is
1664.Sy name, size, alloc, free, fragmentation, expandsize, capacity,
1665.Sy dedupratio, health, altroot .
1666.It Fl L
1667Display real paths for vdevs resolving all symbolic links. This can
1668be used to look up the current block device name regardless of the
1669/dev/disk/ path used to open it.
1670.It Fl p
1671Display numbers in parsable
1672.Pq exact
1673values.
1674.It Fl P
1675Display full paths for vdevs instead of only the last component of
1676the path. This can be used in conjunction with the
1677.Fl L flag.
1678.It Fl T Sy u Ns | Ns Sy d
6e1b9d03 1679Display a time stamp.
cda0317e
GM
1680Specify
1681.Fl u
1682for a printed representation of the internal representation of time.
1683See
1684.Xr time 2 .
1685Specify
1686.Fl d
1687for standard date format.
1688See
1689.Xr date 1 .
1690.It Fl v
1691Verbose statistics.
1692Reports usage statistics for individual vdevs within the pool, in addition to
1693the pool-wise statistics.
1694.El
1695.It Xo
1696.Nm
1697.Cm offline
1698.Op Fl f
1699.Op Fl t
1700.Ar pool Ar device Ns ...
1701.Xc
1702Takes the specified physical device offline.
1703While the
1704.Ar device
1705is offline, no attempt is made to read or write to the device.
1706This command is not applicable to spares.
1707.Bl -tag -width Ds
1708.It Fl f
1709Force fault. Instead of offlining the disk, put it into a faulted
1710state. The fault will persist across imports unless the
1711.Fl t
1712flag was specified.
1713.It Fl t
1714Temporary.
1715Upon reboot, the specified physical device reverts to its previous state.
1716.El
1717.It Xo
1718.Nm
1719.Cm online
1720.Op Fl e
1721.Ar pool Ar device Ns ...
1722.Xc
058ac9ba 1723Brings the specified physical device online.
7c9abcf8 1724This command is not applicable to spares.
cda0317e
GM
1725.Bl -tag -width Ds
1726.It Fl e
1727Expand the device to use all available space.
1728If the device is part of a mirror or raidz then all devices must be expanded
1729before the new space will become available to the pool.
1730.El
1731.It Xo
1732.Nm
1733.Cm reguid
1734.Ar pool
1735.Xc
1736Generates a new unique identifier for the pool.
1737You must ensure that all devices in this pool are online and healthy before
1738performing this action.
1739.It Xo
1740.Nm
1741.Cm reopen
d3f2cd7e 1742.Op Fl n
cda0317e
GM
1743.Ar pool
1744.Xc
5853fe79 1745Reopen all the vdevs associated with the pool.
d3f2cd7e
AB
1746.Bl -tag -width Ds
1747.It Fl n
1748Do not restart an in-progress scrub operation. This is not recommended and can
1749result in partially resilvered devices unless a second scrub is performed.
a94d38c0 1750.El
cda0317e
GM
1751.It Xo
1752.Nm
1753.Cm remove
1754.Ar pool Ar device Ns ...
1755.Xc
1756Removes the specified device from the pool.
1757This command currently only supports removing hot spares, cache, and log
1758devices.
1759A mirrored log device can be removed by specifying the top-level mirror for the
1760log.
1761Non-log devices that are part of a mirrored configuration can be removed using
1762the
1763.Nm zpool Cm detach
1764command.
1765Non-redundant and raidz devices cannot be removed from a pool.
1766.It Xo
1767.Nm
1768.Cm replace
1769.Op Fl f
1770.Op Fl o Ar property Ns = Ns Ar value
1771.Ar pool Ar device Op Ar new_device
1772.Xc
1773Replaces
1774.Ar old_device
1775with
1776.Ar new_device .
1777This is equivalent to attaching
1778.Ar new_device ,
1779waiting for it to resilver, and then detaching
1780.Ar old_device .
1781.Pp
1782The size of
1783.Ar new_device
1784must be greater than or equal to the minimum size of all the devices in a mirror
1785or raidz configuration.
1786.Pp
1787.Ar new_device
1788is required if the pool is not redundant.
1789If
1790.Ar new_device
1791is not specified, it defaults to
1792.Ar old_device .
1793This form of replacement is useful after an existing disk has failed and has
1794been physically replaced.
1795In this case, the new disk may have the same
1796.Pa /dev
1797path as the old device, even though it is actually a different disk.
1798ZFS recognizes this.
1799.Bl -tag -width Ds
1800.It Fl f
1801Forces use of
1802.Ar new_device ,
1803even if its appears to be in use.
1804Not all devices can be overridden in this manner.
1805.It Fl o Ar property Ns = Ns Ar value
1806Sets the given pool properties. See the
1807.Sx Properties
1808section for a list of valid properties that can be set.
1809The only property supported at the moment is
1810.Sy ashift .
1811.El
1812.It Xo
1813.Nm
1814.Cm scrub
0ea05c64 1815.Op Fl s | Fl p
cda0317e
GM
1816.Ar pool Ns ...
1817.Xc
0ea05c64 1818Begins a scrub or resumes a paused scrub.
cda0317e
GM
1819The scrub examines all data in the specified pools to verify that it checksums
1820correctly.
1821For replicated
1822.Pq mirror or raidz
1823devices, ZFS automatically repairs any damage discovered during the scrub.
1824The
1825.Nm zpool Cm status
1826command reports the progress of the scrub and summarizes the results of the
1827scrub upon completion.
1828.Pp
1829Scrubbing and resilvering are very similar operations.
1830The difference is that resilvering only examines data that ZFS knows to be out
1831of date
1832.Po
1833for example, when attaching a new device to a mirror or replacing an existing
1834device
1835.Pc ,
1836whereas scrubbing examines all data to discover silent errors due to hardware
1837faults or disk failure.
1838.Pp
1839Because scrubbing and resilvering are I/O-intensive operations, ZFS only allows
1840one at a time.
0ea05c64 1841If a scrub is paused, the
cda0317e 1842.Nm zpool Cm scrub
0ea05c64 1843resumes it.
cda0317e
GM
1844If a resilver is in progress, ZFS does not allow a scrub to be started until the
1845resilver completes.
1846.Bl -tag -width Ds
1847.It Fl s
058ac9ba 1848Stop scrubbing.
cda0317e 1849.El
0ea05c64
AP
1850.Bl -tag -width Ds
1851.It Fl p
1852Pause scrubbing.
e4b6b2db
AP
1853Scrub pause state and progress are periodically synced to disk.
1854If the system is restarted or pool is exported during a paused scrub,
1855even after import, scrub will remain paused until it is resumed.
1856Once resumed the scrub will pick up from the place where it was last
1857checkpointed to disk.
0ea05c64
AP
1858To resume a paused scrub issue
1859.Nm zpool Cm scrub
1860again.
1861.El
cda0317e
GM
1862.It Xo
1863.Nm
1864.Cm set
1865.Ar property Ns = Ns Ar value
1866.Ar pool
1867.Xc
1868Sets the given property on the specified pool.
1869See the
1870.Sx Properties
1871section for more information on what properties can be set and acceptable
1872values.
1873.It Xo
1874.Nm
1875.Cm split
b5256303 1876.Op Fl gLlnP
cda0317e
GM
1877.Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
1878.Op Fl R Ar root
1879.Ar pool newpool
1880.Op Ar device ...
1881.Xc
1882Splits devices off
1883.Ar pool
1884creating
1885.Ar newpool .
1886All vdevs in
1887.Ar pool
1888must be mirrors and the pool must not be in the process of resilvering.
1889At the time of the split,
1890.Ar newpool
1891will be a replica of
1892.Ar pool .
1893By default, the
1894last device in each mirror is split from
1895.Ar pool
1896to create
1897.Ar newpool .
1898.Pp
1899The optional device specification causes the specified device(s) to be
1900included in the new
1901.Ar pool
1902and, should any devices remain unspecified,
1903the last device in each mirror is used as would be by default.
1904.Bl -tag -width Ds
1905.It Fl g
1906Display vdev GUIDs instead of the normal device names. These GUIDs
1907can be used in place of device names for the zpool
1908detach/offline/remove/replace commands.
1909.It Fl L
1910Display real paths for vdevs resolving all symbolic links. This can
1911be used to look up the current block device name regardless of the
1912.Pa /dev/disk/
1913path used to open it.
b5256303
TC
1914.It Fl l
1915Indicates that this command will request encryption keys for all encrypted
1916datasets it attempts to mount as it is bringing the new pool online. Note that
1917if any datasets have a
1918.Sy keylocation
1919of
1920.Sy prompt
1921this command will block waiting for the keys to be entered. Without this flag
1922encrypted datasets will be left unavailable until the keys are loaded.
cda0317e
GM
1923.It Fl n
1924Do dry run, do not actually perform the split.
1925Print out the expected configuration of
1926.Ar newpool .
1927.It Fl P
1928Display full paths for vdevs instead of only the last component of
1929the path. This can be used in conjunction with the
1930.Fl L flag.
1931.It Fl o Ar property Ns = Ns Ar value
1932Sets the specified property for
1933.Ar newpool .
1934See the
1935.Sx Properties
1936section for more information on the available pool properties.
1937.It Fl R Ar root
1938Set
1939.Sy altroot
1940for
1941.Ar newpool
1942to
1943.Ar root
1944and automatically import it.
1945.El
1946.It Xo
1947.Nm
1948.Cm status
7a8ed6b8 1949.Op Fl c Op Ar SCRIPT1 Ns Oo , Ns Ar SCRIPT2 Oc Ns ...
cda0317e
GM
1950.Op Fl gLPvxD
1951.Op Fl T Sy u Ns | Ns Sy d
1952.Oo Ar pool Oc Ns ...
1953.Op Ar interval Op Ar count
1954.Xc
1955Displays the detailed health status for the given pools.
1956If no
1957.Ar pool
1958is specified, then the status of each pool in the system is displayed.
1959For more information on pool and device health, see the
1960.Sx Device Failure and Recovery
1961section.
1962.Pp
1963If a scrub or resilver is in progress, this command reports the percentage done
1964and the estimated time to completion.
1965Both of these are only approximate, because the amount of data in the pool and
1966the other workloads on the system can change.
1967.Bl -tag -width Ds
7a8ed6b8 1968.It Fl c Op Ar SCRIPT1 Ns Oo , Ns Ar SCRIPT2 Oc Ns ...
cda0317e
GM
1969Run a script (or scripts) on each vdev and include the output as a new column
1970in the
1971.Nm zpool Cm status
1972output. See the
1973.Fl c
1974option of
1975.Nm zpool Cm iostat
1976for complete details.
1977.It Fl g
1978Display vdev GUIDs instead of the normal device names. These GUIDs
1979can be used in place of device names for the zpool
1980detach/offline/remove/replace commands.
1981.It Fl L
1982Display real paths for vdevs resolving all symbolic links. This can
1983be used to look up the current block device name regardless of the
1984.Pa /dev/disk/
1985path used to open it.
f4ae39a1
BB
1986.It Fl P
1987Display full paths for vdevs instead of only the last component of
1988the path. This can be used in conjunction with the
1989.Fl L flag.
cda0317e
GM
1990.It Fl D
1991Display a histogram of deduplication statistics, showing the allocated
1992.Pq physically present on disk
1993and referenced
1994.Pq logically referenced in the pool
1995block counts and sizes by reference count.
1996.It Fl T Sy u Ns | Ns Sy d
2e2ddc30 1997Display a time stamp.
cda0317e
GM
1998Specify
1999.Fl u
2000for a printed representation of the internal representation of time.
2001See
2002.Xr time 2 .
2003Specify
2004.Fl d
2005for standard date format.
2006See
2007.Xr date 1 .
2008.It Fl v
2009Displays verbose data error information, printing out a complete list of all
2010data errors since the last complete pool scrub.
2011.It Fl x
2012Only display status for pools that are exhibiting errors or are otherwise
2013unavailable.
2014Warnings about pools not using the latest on-disk format will not be included.
2015.El
2016.It Xo
2017.Nm
2018.Cm sync
2019.Op Ar pool ...
2020.Xc
2021This command forces all in-core dirty data to be written to the primary
2022pool storage and not the ZIL. It will also update administrative
2023information including quota reporting. Without arguments,
2024.Sy zpool sync
2025will sync all pools on the system. Otherwise, it will sync only the
2026specified pool(s).
2027.It Xo
2028.Nm
2029.Cm upgrade
2030.Xc
2031Displays pools which do not have all supported features enabled and pools
2032formatted using a legacy ZFS version number.
2033These pools can continue to be used, but some features may not be available.
2034Use
2035.Nm zpool Cm upgrade Fl a
2036to enable all features on all pools.
2037.It Xo
2038.Nm
2039.Cm upgrade
2040.Fl v
2041.Xc
2042Displays legacy ZFS versions supported by the current software.
2043See
2044.Xr zpool-features 5
2045for a description of feature flags features supported by the current software.
2046.It Xo
2047.Nm
2048.Cm upgrade
2049.Op Fl V Ar version
2050.Fl a Ns | Ns Ar pool Ns ...
2051.Xc
2052Enables all supported features on the given pool.
2053Once this is done, the pool will no longer be accessible on systems that do not
2054support feature flags.
2055See
2056.Xr zfs-features 5
2057for details on compatibility with systems that support feature flags, but do not
2058support all features enabled on the pool.
2059.Bl -tag -width Ds
2060.It Fl a
b9b24bb4 2061Enables all supported features on all pools.
cda0317e
GM
2062.It Fl V Ar version
2063Upgrade to the specified legacy version.
2064If the
2065.Fl V
2066flag is specified, no features will be enabled on the pool.
2067This option can only be used to increase the version number up to the last
2068supported legacy version number.
2069.El
2070.El
2071.Sh EXIT STATUS
2072The following exit values are returned:
2073.Bl -tag -width Ds
2074.It Sy 0
2075Successful completion.
2076.It Sy 1
2077An error occurred.
2078.It Sy 2
2079Invalid command line options were specified.
2080.El
2081.Sh EXAMPLES
2082.Bl -tag -width Ds
2083.It Sy Example 1 No Creating a RAID-Z Storage Pool
2084The following command creates a pool with a single raidz root vdev that
2085consists of six disks.
2086.Bd -literal
2087# zpool create tank raidz sda sdb sdc sdd sde sdf
2088.Ed
2089.It Sy Example 2 No Creating a Mirrored Storage Pool
2090The following command creates a pool with two mirrors, where each mirror
2091contains two disks.
2092.Bd -literal
2093# zpool create tank mirror sda sdb mirror sdc sdd
2094.Ed
2095.It Sy Example 3 No Creating a ZFS Storage Pool by Using Partitions
54e5f226 2096The following command creates an unmirrored pool using two disk partitions.
cda0317e
GM
2097.Bd -literal
2098# zpool create tank sda1 sdb2
2099.Ed
2100.It Sy Example 4 No Creating a ZFS Storage Pool by Using Files
2101The following command creates an unmirrored pool using files.
2102While not recommended, a pool based on files can be useful for experimental
2103purposes.
2104.Bd -literal
2105# zpool create tank /path/to/file/a /path/to/file/b
2106.Ed
2107.It Sy Example 5 No Adding a Mirror to a ZFS Storage Pool
2108The following command adds two mirrored disks to the pool
2109.Em tank ,
2110assuming the pool is already made up of two-way mirrors.
2111The additional space is immediately available to any datasets within the pool.
2112.Bd -literal
2113# zpool add tank mirror sda sdb
2114.Ed
2115.It Sy Example 6 No Listing Available ZFS Storage Pools
2116The following command lists all available pools on the system.
2117In this case, the pool
2118.Em zion
2119is faulted due to a missing device.
058ac9ba 2120The results from this command are similar to the following:
cda0317e
GM
2121.Bd -literal
2122# zpool list
f3a7f661
GW
2123NAME SIZE ALLOC FREE FRAG EXPANDSZ CAP DEDUP HEALTH ALTROOT
2124rpool 19.9G 8.43G 11.4G 33% - 42% 1.00x ONLINE -
2125tank 61.5G 20.0G 41.5G 48% - 32% 1.00x ONLINE -
2126zion - - - - - - - FAULTED -
cda0317e
GM
2127.Ed
2128.It Sy Example 7 No Destroying a ZFS Storage Pool
2129The following command destroys the pool
2130.Em tank
2131and any datasets contained within.
2132.Bd -literal
2133# zpool destroy -f tank
2134.Ed
2135.It Sy Example 8 No Exporting a ZFS Storage Pool
2136The following command exports the devices in pool
2137.Em tank
2138so that they can be relocated or later imported.
2139.Bd -literal
2140# zpool export tank
2141.Ed
2142.It Sy Example 9 No Importing a ZFS Storage Pool
2143The following command displays available pools, and then imports the pool
2144.Em tank
2145for use on the system.
058ac9ba 2146The results from this command are similar to the following:
cda0317e
GM
2147.Bd -literal
2148# zpool import
058ac9ba
BB
2149 pool: tank
2150 id: 15451357997522795478
2151 state: ONLINE
2152action: The pool can be imported using its name or numeric identifier.
2153config:
2154
2155 tank ONLINE
2156 mirror ONLINE
54e5f226
RL
2157 sda ONLINE
2158 sdb ONLINE
058ac9ba 2159
cda0317e
GM
2160# zpool import tank
2161.Ed
2162.It Sy Example 10 No Upgrading All ZFS Storage Pools to the Current Version
2163The following command upgrades all ZFS Storage pools to the current version of
2164the software.
2165.Bd -literal
2166# zpool upgrade -a
2167This system is currently running ZFS version 2.
2168.Ed
2169.It Sy Example 11 No Managing Hot Spares
058ac9ba 2170The following command creates a new pool with an available hot spare:
cda0317e
GM
2171.Bd -literal
2172# zpool create tank mirror sda sdb spare sdc
2173.Ed
2174.Pp
2175If one of the disks were to fail, the pool would be reduced to the degraded
2176state.
2177The failed device can be replaced using the following command:
2178.Bd -literal
2179# zpool replace tank sda sdd
2180.Ed
2181.Pp
2182Once the data has been resilvered, the spare is automatically removed and is
7c9abcf8 2183made available for use should another device fail.
cda0317e
GM
2184The hot spare can be permanently removed from the pool using the following
2185command:
2186.Bd -literal
2187# zpool remove tank sdc
2188.Ed
2189.It Sy Example 12 No Creating a ZFS Pool with Mirrored Separate Intent Logs
2190The following command creates a ZFS storage pool consisting of two, two-way
2191mirrors and mirrored log devices:
2192.Bd -literal
2193# zpool create pool mirror sda sdb mirror sdc sdd log mirror \\
2194 sde sdf
2195.Ed
2196.It Sy Example 13 No Adding Cache Devices to a ZFS Pool
2197The following command adds two disks for use as cache devices to a ZFS storage
2198pool:
2199.Bd -literal
2200# zpool add pool cache sdc sdd
2201.Ed
2202.Pp
2203Once added, the cache devices gradually fill with content from main memory.
2204Depending on the size of your cache devices, it could take over an hour for
2205them to fill.
2206Capacity and reads can be monitored using the
2207.Cm iostat
2208option as follows:
2209.Bd -literal
2210# zpool iostat -v pool 5
2211.Ed
2212.It Sy Example 14 No Removing a Mirrored Log Device
2213The following command removes the mirrored log device
2214.Sy mirror-2 .
058ac9ba 2215Given this configuration:
cda0317e
GM
2216.Bd -literal
2217 pool: tank
2218 state: ONLINE
2219 scrub: none requested
058ac9ba
BB
2220config:
2221
2222 NAME STATE READ WRITE CKSUM
2223 tank ONLINE 0 0 0
2224 mirror-0 ONLINE 0 0 0
54e5f226
RL
2225 sda ONLINE 0 0 0
2226 sdb ONLINE 0 0 0
058ac9ba 2227 mirror-1 ONLINE 0 0 0
54e5f226
RL
2228 sdc ONLINE 0 0 0
2229 sdd ONLINE 0 0 0
058ac9ba
BB
2230 logs
2231 mirror-2 ONLINE 0 0 0
54e5f226
RL
2232 sde ONLINE 0 0 0
2233 sdf ONLINE 0 0 0
cda0317e
GM
2234.Ed
2235.Pp
2236The command to remove the mirrored log
2237.Sy mirror-2
2238is:
2239.Bd -literal
2240# zpool remove tank mirror-2
2241.Ed
2242.It Sy Example 15 No Displaying expanded space on a device
2243The following command displays the detailed information for the pool
2244.Em data .
2245This pool is comprised of a single raidz vdev where one of its devices
2246increased its capacity by 10GB.
2247In this example, the pool will not be able to utilize this extra capacity until
2248all the devices under the raidz vdev have been expanded.
2249.Bd -literal
2250# zpool list -v data
f3a7f661
GW
2251NAME SIZE ALLOC FREE FRAG EXPANDSZ CAP DEDUP HEALTH ALTROOT
2252data 23.9G 14.6G 9.30G 48% - 61% 1.00x ONLINE -
2253 raidz1 23.9G 14.6G 9.30G 48% -
cda0317e
GM
2254 sda - - - - -
2255 sdb - - - - 10G
2256 sdc - - - - -
2257.Ed
2258.It Sy Example 16 No Adding output columns
2259Additional columns can be added to the
2260.Nm zpool Cm status
2261and
2262.Nm zpool Cm iostat
2263output with
2264.Fl c
2265option.
2266.Bd -literal
2267# zpool status -c vendor,model,size
2268 NAME STATE READ WRITE CKSUM vendor model size
2269 tank ONLINE 0 0 0
2270 mirror-0 ONLINE 0 0 0
2271 U1 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T
2272 U10 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T
2273 U11 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T
2274 U12 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T
2275 U13 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T
2276 U14 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T
2277
2278# zpool iostat -vc slaves
2279 capacity operations bandwidth
2280 pool alloc free read write read write slaves
2281 ---------- ----- ----- ----- ----- ----- ----- ---------
2282 tank 20.4G 7.23T 26 152 20.7M 21.6M
2283 mirror 20.4G 7.23T 26 152 20.7M 21.6M
2284 U1 - - 0 31 1.46K 20.6M sdb sdff
2285 U10 - - 0 1 3.77K 13.3K sdas sdgw
2286 U11 - - 0 1 288K 13.3K sdat sdgx
2287 U12 - - 0 1 78.4K 13.3K sdau sdgy
2288 U13 - - 0 1 128K 13.3K sdav sdgz
2289 U14 - - 0 1 63.2K 13.3K sdfk sdg
2290.Ed
2291.El
2292.Sh ENVIRONMENT VARIABLES
2293.Bl -tag -width "ZFS_ABORT"
2294.It Ev ZFS_ABORT
2295Cause
2296.Nm zpool
2297to dump core on exit for the purposes of running
90cdf283 2298.Sy ::findleaks .
cda0317e
GM
2299.El
2300.Bl -tag -width "ZPOOL_IMPORT_PATH"
2301.It Ev ZPOOL_IMPORT_PATH
2302The search path for devices or files to use with the pool. This is a colon-separated list of directories in which
2303.Nm zpool
2304looks for device nodes and files.
2305Similar to the
2306.Fl d
2307option in
2308.Nm zpool import .
2309.El
2310.Bl -tag -width "ZPOOL_VDEV_NAME_GUID"
2311.It Ev ZPOOL_VDEV_NAME_GUID
2312Cause
2313.Nm zpool subcommands to output vdev guids by default. This behavior
2314is identical to the
2315.Nm zpool status -g
2316command line option.
2317.El
2318.Bl -tag -width "ZPOOL_VDEV_NAME_FOLLOW_LINKS"
2319.It Ev ZPOOL_VDEV_NAME_FOLLOW_LINKS
2320Cause
2321.Nm zpool
2322subcommands to follow links for vdev names by default. This behavior is identical to the
2323.Nm zpool status -L
2324command line option.
2325.El
2326.Bl -tag -width "ZPOOL_VDEV_NAME_PATH"
2327.It Ev ZPOOL_VDEV_NAME_PATH
2328Cause
2329.Nm zpool
2330subcommands to output full vdev path names by default. This
2331behavior is identical to the
2332.Nm zpool status -p
2333command line option.
2334.El
2335.Bl -tag -width "ZFS_VDEV_DEVID_OPT_OUT"
2336.It Ev ZFS_VDEV_DEVID_OPT_OUT
39fc0cb5 2337Older ZFS on Linux implementations had issues when attempting to display pool
cda0317e
GM
2338config VDEV names if a
2339.Sy devid
2340NVP value is present in the pool's config.
2341.Pp
39fc0cb5 2342For example, a pool that originated on illumos platform would have a devid
cda0317e
GM
2343value in the config and
2344.Nm zpool status
2345would fail when listing the config.
39fc0cb5 2346This would also be true for future Linux based pools.
cda0317e
GM
2347.Pp
2348A pool can be stripped of any
2349.Sy devid
2350values on import or prevented from adding
2351them on
2352.Nm zpool create
2353or
2354.Nm zpool add
2355by setting
2356.Sy ZFS_VDEV_DEVID_OPT_OUT .
2357.El
2358.Bl -tag -width "ZPOOL_SCRIPTS_AS_ROOT"
2359.It Ev ZPOOL_SCRIPTS_AS_ROOT
7a8ed6b8 2360Allow a privileged user to run the
cda0317e
GM
2361.Nm zpool status/iostat
2362with the
2363.Fl c
7a8ed6b8 2364option. Normally, only unprivileged users are allowed to run
cda0317e
GM
2365.Fl c .
2366.El
2367.Bl -tag -width "ZPOOL_SCRIPTS_PATH"
2368.It Ev ZPOOL_SCRIPTS_PATH
2369The search path for scripts when running
2370.Nm zpool status/iostat
2371with the
2372.Fl c
099700d9 2373option. This is a colon-separated list of directories and overrides the default
cda0317e
GM
2374.Pa ~/.zpool.d
2375and
2376.Pa /etc/zfs/zpool.d
2377search paths.
2378.El
2379.Bl -tag -width "ZPOOL_SCRIPTS_ENABLED"
2380.It Ev ZPOOL_SCRIPTS_ENABLED
2381Allow a user to run
2382.Nm zpool status/iostat
2383with the
2384.Fl c
2385option. If
2386.Sy ZPOOL_SCRIPTS_ENABLED
2387is not set, it is assumed that the user is allowed to run
2388.Nm zpool status/iostat -c .
90cdf283 2389.El
cda0317e
GM
2390.Sh INTERFACE STABILITY
2391.Sy Evolving
2392.Sh SEE ALSO
cda0317e
GM
2393.Xr zfs-events 5 ,
2394.Xr zfs-module-parameters 5 ,
90cdf283 2395.Xr zpool-features 5 ,
2396.Xr zed 8 ,
2397.Xr zfs 8