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