Deleted Added
sdiff udiff text old ( 234336 ) new ( 236155 )
full compact
1'\" te
2.\" Copyright (c) 2011, Martin Matuska <mm@FreeBSD.org>.
3.\" All Rights Reserved.
4.\"
5.\" The contents of this file are subject to the terms of the
6.\" Common Development and Distribution License (the "License").
7.\" You may not use this file except in compliance with the License.
8.\"
9.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10.\" or http://www.opensolaris.org/os/licensing.
11.\" See the License for the specific language governing permissions
12.\" and limitations under the License.
13.\"
14.\" When distributing Covered Code, include this CDDL HEADER in each
15.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16.\" If applicable, add the following below this CDDL HEADER, with the
17.\" fields enclosed by brackets "[]" replaced with your own identifying
18.\" information: Portions Copyright [yyyy] [name of copyright owner]
19.\"
20.\" Copyright (c) 2010, Sun Microsystems, Inc. All Rights Reserved.
21.\" Copyright 2011, Nexenta Systems, Inc. All Rights Reserved.
22.\" Copyright (c) 2011, Justin T. Gibbs <gibbs@FreeBSD.org>
23.\"
24.\" $FreeBSD: head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 236155 2012-05-27 16:00:00Z mm $
25.\"
26.Dd November 28, 2011
27.Dt ZPOOL 8
28.Os
29.Sh NAME
30.Nm zpool
31.Nd configures ZFS storage pools
32.Sh SYNOPSIS
33.Nm
34.Op Fl \&?
35.Nm
36.Cm add
37.Op Fl fn
38.Ar pool vdev ...
39.Nm
40.Cm attach
41.Op Fl f
42.Ar pool device new_device
43.Nm
44.Cm clear
45.Op Fl F Op Fl n
46.Ar pool
47.Op Ar device
48.Nm
49.Cm create
50.Op Fl fn
51.Op Fl o Ar property Ns = Ns Ar value
52.Ar ...
53.Op Fl O Ar file-system-property Ns = Ns Ar value
54.Ar ...
55.Op Fl m Ar mountpoint
56.Op Fl R Ar root
57.Ar pool vdev ...
58.Nm
59.Cm destroy
60.Op Fl f
61.Ar pool
62.Nm
63.Cm detach
64.Ar pool device
65.Nm
66.Cm export
67.Op Fl f
68.Ar pool ...
69.Nm
70.Cm get
71.Ar all | property Ns Op , Ns Ar ...
72.Ar pool ...
73.Nm
74.Cm history
75.Op Fl il
76.Op Ar pool
77.Ar ...
78.Nm
79.Cm import
80.Op Fl d Ar dir | Fl c Ar cachefile
81.Op Fl D
82.Nm
83.Cm import
84.Op Fl o Ar mntopts
85.Op Fl o Ar property Ns = Ns Ar value
86.Ar ...
87.Op Fl d Ar dir | Fl c Ar cachefile
88.Op Fl D
89.Op Fl f
90.Op Fl m
91.Op Fl N
92.Op Fl R Ar root
93.Op Fl F Op Fl n
94.Fl a
95.Nm
96.Cm import
97.Op Fl o Ar mntopts
98.Op Fl o Ar property Ns = Ns Ar value
99.Ar ...
100.Op Fl d Ar dir | Fl c Ar cachefile
101.Op Fl D
102.Op Fl f
103.Op Fl m
104.Op Fl N
105.Op Fl R Ar root
106.Op Fl F Op Fl n
107.Ar pool | id
108.Op Ar newpool
109.Nm
110.Cm iostat
111.Op Fl T Cm d Ns | Ns Cm u
112.Op Fl v
113.Op Ar pool
114.Ar ...
115.Nm
116.Cm labelclear
117.Op Fl f
118.Ar device
119.Nm
120.Cm list
121.Op Fl H
122.Op Fl o Ar property Ns Op , Ns Ar ...
123.Op Fl T Cm d Ns | Ns Cm u
124.Op Ar pool
125.Ar ...
126.Op Ar inverval Op Ar count
127.Nm
128.Cm offline
129.Op Fl t
130.Ar pool device ...
131.Nm
132.Cm online
133.Op Fl e
134.Ar pool device ...
135.Nm
136.Cm reguid
137.Ar pool
138.Nm
139.Cm remove
140.Ar pool device ...
141.Nm
142.Cm replace
143.Op Fl f
144.Ar pool device
145.Op Ar new_device
146.Nm
147.Cm scrub
148.Op Fl s
149.Ar pool ...
150.Nm
151.Cm set
152.Ar property Ns = Ns Ar value pool
153.Nm
154.Cm split
155.Op Fl n
156.Op Fl R Ar altroot
157.Op Fl o Ar mntopts
158.Op Fl o Ar property Ns = Ns Ar value
159.Ar pool newpool
160.Op Ar device ...
161.Nm
162.Cm status
163.Op Fl vx
164.Op Fl T Cm d Ns | Ns Cm u
165.Op Ar pool
166.Ar ...
167.Op Ar interval Op Ar count
168.Nm
169.Cm upgrade
170.Op Fl v
171.Nm
172.Cm upgrade
173.Op Fl V Ar version
174.Fl a | Ar pool ...
175.Sh DESCRIPTION
176The
177.Nm
178command configures
179.Tn ZFS
180storage pools. A storage pool is a collection of devices that provides physical
181storage and data replication for
182.Tn ZFS
183datasets.
184.Pp
185All datasets within a storage pool share the same space. See
186.Xr zfs 8
187for information on managing datasets.
188.Ss Virtual Devices (vdevs)
189A
190.Qq virtual device
191.Pq No vdev
192describes a single device or a collection of devices organized according to
193certain performance and fault characteristics. The following virtual devices
194are supported:
195.Bl -tag
196.It Sy disk
197A block device, typically located under
198.Pa /dev .
199.Tn ZFS
200can use individual slices or partitions, though the recommended mode of
201operation is to use whole disks. A disk can be specified by a full path to the
202device or the
203.Xr geom 4
204provider name. When given a whole disk,
205.Tn ZFS
206automatically labels the disk, if necessary.
207.It Sy file
208A regular file. The use of files as a backing store is strongly discouraged. It
209is designed primarily for experimental purposes, as the fault tolerance of a
210file is only as good the file system of which it is a part. A file must be
211specified by a full path.
212.It Sy mirror
213A mirror of two or more devices. Data is replicated in an identical fashion
214across all components of a mirror. A mirror with
215.Em N
216disks of size
217.Em X
218can hold
219.Em X
220bytes and can withstand
221.Pq Em N-1
222devices failing before data integrity is compromised.
223.It Sy raidz
224(or
225.Sy raidz1 raidz2 raidz3 ) .
226A variation on
227.Sy RAID-5
228that allows for better distribution of parity and eliminates the
229.Qq Sy RAID-5
230write hole (in which data and parity become inconsistent after a power loss).
231Data and parity is striped across all disks within a
232.No raidz
233group.
234.Pp
235A
236.No raidz
237group can have single-, double- , or triple parity, meaning that the
238.No raidz
239group can sustain one, two, or three failures, respectively, without
240losing any data. The
241.Sy raidz1 No vdev
242type specifies a single-parity
243.No raidz
244group; the
245.Sy raidz2 No vdev
246type specifies a double-parity
247.No raidz
248group; and the
249.Sy raidz3 No vdev
250type specifies a triple-parity
251.No raidz
252group. The
253.Sy raidz No vdev
254type is an alias for
255.Sy raidz1 .
256.Pp
257A
258.No raidz
259group with
260.Em N
261disks of size
262.Em X
263with
264.Em P
265parity disks can hold approximately
266.Sm off
267.Pq Em N-P
268*X
269.Sm on
270bytes and can withstand
271.Em P
272device(s) failing before data integrity is compromised. The minimum number of
273devices in a
274.No raidz
275group is one more than the number of parity disks. The
276recommended number is between 3 and 9 to help increase performance.
277.It Sy spare
278A special
279.No pseudo- Ns No vdev
280which keeps track of available hot spares for a pool.
281For more information, see the
282.Qq Sx Hot Spares
283section.
284.It Sy log
285A separate-intent log device. If more than one log device is specified, then
286writes are load-balanced between devices. Log devices can be mirrored. However,
287.No raidz
288.No vdev
289types are not supported for the intent log. For more information,
290see the
291.Qq Sx Intent Log
292section.
293.It Sy cache
294A device used to cache storage pool data. A cache device cannot be configured
295as a mirror or
296.No raidz
297group. For more information, see the
298.Qq Sx Cache Devices
299section.
300.El
301.Pp
302Virtual devices cannot be nested, so a mirror or
303.No raidz
304virtual device can only
305contain files or disks. Mirrors of mirrors (or other combinations) are not
306allowed.
307.Pp
308A pool can have any number of virtual devices at the top of the configuration
309(known as
310.Qq root
311.No vdev Ns s).
312Data is dynamically distributed across all top-level devices to balance data
313among devices. As new virtual devices are added,
314.Tn ZFS
315automatically places data on the newly available devices.
316.Pp
317Virtual devices are specified one at a time on the command line, separated by
318whitespace. The keywords
319.Qq mirror
320and
321.Qq raidz
322are used to distinguish where a group ends and another begins. For example, the
323following creates two root
324.No vdev Ns s,
325each a mirror of two disks:
326.Bd -literal -offset 2n
327.Li # Ic zpool create mypool mirror da0 da1 mirror da2 da3
328.Ed
329.Ss Device Failure and Recovery
330.Tn ZFS
331supports a rich set of mechanisms for handling device failure and data
332corruption. All metadata and data is checksummed, and
333.Tn ZFS
334automatically repairs bad data from a good copy when corruption is detected.
335.Pp
336In order to take advantage of these features, a pool must make use of some form
337of redundancy, using either mirrored or
338.No raidz
339groups. While
340.Tn ZFS
341supports running in a non-redundant configuration, where each root
342.No vdev
343is simply a disk or file, this is strongly discouraged. A single case of bit
344corruption can render some or all of your data unavailable.
345.Pp
346A pool's health status is described by one of three states: online, degraded,
347or faulted. An online pool has all devices operating normally. A degraded pool
348is one in which one or more devices have failed, but the data is still
349available due to a redundant configuration. A faulted pool has corrupted
350metadata, or one or more faulted devices, and insufficient replicas to continue
351functioning.
352.Pp
353The health of the top-level
354.No vdev ,
355such as mirror or
356.No raidz
357device, is
358potentially impacted by the state of its associated
359.No vdev Ns s,
360or component devices. A top-level
361.No vdev
362or component device is in one of the following states:
363.Bl -tag -width "DEGRADED"
364.It Sy DEGRADED
365One or more top-level
366.No vdev Ns s
367is in the degraded state because one or more
368component devices are offline. Sufficient replicas exist to continue
369functioning.
370.Pp
371One or more component devices is in the degraded or faulted state, but
372sufficient replicas exist to continue functioning. The underlying conditions
373are as follows:
374.Bl -bullet -offset 2n
375.It
376The number of checksum errors exceeds acceptable levels and the device is
377degraded as an indication that something may be wrong.
378.Tn ZFS
379continues to use the device as necessary.
380.It
381The number of
382.Tn I/O
383errors exceeds acceptable levels. The device could not be
384marked as faulted because there are insufficient replicas to continue
385functioning.
386.El
387.It Sy FAULTED
388One or more top-level
389.No vdev Ns s
390is in the faulted state because one or more
391component devices are offline. Insufficient replicas exist to continue
392functioning.
393.Pp
394One or more component devices is in the faulted state, and insufficient
395replicas exist to continue functioning. The underlying conditions are as
396follows:
397.Bl -bullet -offset 2n
398.It
399The device could be opened, but the contents did not match expected values.
400.It
401The number of
402.Tn I/O
403errors exceeds acceptable levels and the device is faulted to
404prevent further use of the device.
405.El
406.It Sy OFFLINE
407The device was explicitly taken offline by the
408.Qq Nm Cm offline
409command.
410.It Sy ONLINE
411The device is online and functioning.
412.It Sy REMOVED
413The device was physically removed while the system was running. Device removal
414detection is hardware-dependent and may not be supported on all platforms.
415.It Sy UNAVAIL
416The device could not be opened. If a pool is imported when a device was
417unavailable, then the device will be identified by a unique identifier instead
418of its path since the path was never correct in the first place.
419.El
420.Pp
421If a device is removed and later reattached to the system,
422.Tn ZFS
423attempts to put the device online automatically. Device attach detection is
424hardware-dependent and might not be supported on all platforms.
425.Ss Hot Spares
426.Tn ZFS
427allows devices to be associated with pools as
428.Qq hot spares .
429These devices are not actively used in the pool, but when an active device
430fails, it is automatically replaced by a hot spare. To create a pool with hot
431spares, specify a
432.Qq spare
433.No vdev
434with any number of devices. For example,
435.Bd -literal -offset 2n
436.Li # Ic zpool create pool mirror da0 da1 spare da2 da3
437.Ed
438.Pp
439Spares can be shared across multiple pools, and can be added with the
440.Qq Nm Cm add
441command and removed with the
442.Qq Nm Cm remove
443command. Once a spare replacement is initiated, a new "spare"
444.No vdev
445is created
446within the configuration that will remain there until the original device is
447replaced. At this point, the hot spare becomes available again if another
448device fails.
449.Pp
450If a pool has a shared spare that is currently being used, the pool can not be
451exported since other pools may use this shared spare, which may lead to
452potential data corruption.
453.Pp
454An in-progress spare replacement can be cancelled by detaching the hot spare.
455If the original faulted device is detached, then the hot spare assumes its
456place in the configuration, and is removed from the spare list of all active
457pools.
458.Pp
459Spares cannot replace log devices.
460.Ss Intent Log
461The
462.Tn ZFS
463Intent Log
464.Pq Tn ZIL
465satisfies
466.Tn POSIX
467requirements for synchronous transactions. For instance, databases often
468require their transactions to be on stable storage devices when returning from
469a system call.
470.Tn NFS
471and other applications can also use
472.Xr fsync 2
473to ensure data stability. By default, the intent log is allocated from blocks
474within the main pool. However, it might be possible to get better performance
475using separate intent log devices such as
476.Tn NVRAM
477or a dedicated disk. For example:
478.Bd -literal -offset 2n
479.Li # Ic zpool create pool da0 da1 log da2
480.Ed
481.Pp
482Multiple log devices can also be specified, and they can be mirrored. See the
483.Sx EXAMPLES
484section for an example of mirroring multiple log devices.
485.Pp
486Log devices can be added, replaced, attached, detached, imported and exported
487as part of the larger pool. Mirrored log devices can be removed by specifying
488the top-level mirror for the log.
489.Ss Cache devices
490Devices can be added to a storage pool as "cache devices." These devices
491provide an additional layer of caching between main memory and disk. For
492read-heavy workloads, where the working set size is much larger than what can
493be cached in main memory, using cache devices allow much more of this working
494set to be served from low latency media. Using cache devices provides the
495greatest performance improvement for random read-workloads of mostly static
496content.
497.Pp
498To create a pool with cache devices, specify a "cache"
499.No vdev
500with any number of devices. For example:
501.Bd -literal -offset 2n
502.Li # Ic zpool create pool da0 da1 cache da2 da3
503.Ed
504.Pp
505Cache devices cannot be mirrored or part of a
506.No raidz
507configuration. If a read
508error is encountered on a cache device, that read
509.Tn I/O
510is reissued to the original storage pool device, which might be part of a
511mirrored or
512.No raidz
513configuration.
514.Pp
515The content of the cache devices is considered volatile, as is the case with
516other system caches.
517.Ss Properties
518Each pool has several properties associated with it. Some properties are
519read-only statistics while others are configurable and change the behavior of
520the pool. The following are read-only properties:
521.Bl -tag -width "dedupratio"
522.It Sy alloc
523Amount of storage space within the pool that has been physically allocated.
524.It Sy capacity
525Percentage of pool space used. This property can also be referred to by its
526shortened column name, "cap".
527.It Sy comment
528A text string consisting of printable ASCII characters that will be stored
529such that it is available even if the pool becomes faulted. An administrator
530can provide additional information about a pool using this property.
531.It Sy dedupratio
532The deduplication ratio specified for a pool, expressed as a multiplier.
533For example, a
534.S dedupratio
535value of 1.76 indicates that 1.76 units of data were stored but only 1 unit of disk space was actually consumed. See
536.Xr zfs 8
537for a description of the deduplication feature.
538.It Sy free
539Number of blocks within the pool that are not allocated.
540.It Sy expandsize
541This property has currently no value on FreeBSD.
542.It Sy guid
543A unique identifier for the pool.
544.It Sy health
545The current health of the pool. Health can be
546.Qq Sy ONLINE ,
547.Qq Sy DEGRADED ,
548.Qq Sy FAULTED ,
549.Qq Sy OFFLINE ,
550.Qq Sy REMOVED ,
551or
552.Qq Sy UNAVAIL .
553.It Sy size
554Total size of the storage pool.
555.It Sy used
556Amount of storage space used within the pool.
557.El
558.Pp
559These space usage properties report actual physical space available to the
560storage pool. The physical space can be different from the total amount of
561space that any contained datasets can actually use. The amount of space used in
562a
563.No raidz
564configuration depends on the characteristics of the data being written.
565In addition,
566.Tn ZFS
567reserves some space for internal accounting that the
568.Xr zfs 8
569command takes into account, but the
570.Xr zpool 8
571command does not. For non-full pools of a reasonable size, these effects should
572be invisible. For small pools, or pools that are close to being completely
573full, these discrepancies may become more noticeable.
574.Pp
575The following property can be set at creation time and import time:
576.Bl -tag -width 2n
577.It Sy altroot
578Alternate root directory. If set, this directory is prepended to any mount
579points within the pool. This can be used when examining an unknown pool where
580the mount points cannot be trusted, or in an alternate boot environment, where
581the typical paths are not valid.
582.Sy altroot
583is not a persistent property. It is valid only while the system is up.
584Setting
585.Sy altroot
586defaults to using
587.Cm cachefile=none ,
588though this may be overridden using an explicit setting.
589.El
590.Pp
591The following property can only be set at import time:
592.Bl -tag -width 2n
593.It Sy readonly Ns = Ns Cm on No | Cm off
594If set to
595.Cm on ,
596pool will be imported in read-only mode with the following restrictions:
597.Bl -bullet -offset 2n
598.It
599Synchronous data in the intent log will not be accessible
600.It
601Properties of the pool can not be changed
602.It
603Datasets of this pool can only be mounted read-only
604.It
605To write to a read-only pool, a export and import of the pool is required.
606.El
607.El
608.Pp
609The following properties can be set at creation time and import time, and later
610changed with the
611.Ic zpool set
612command:
613.Bl -tag -width 2n
614.It Sy autoexpand Ns = Ns Cm on No | Cm off
615Controls automatic pool expansion when the underlying LUN is grown. If set to
616.Qq Cm on ,
617the pool will be resized according to the size of the expanded
618device. If the device is part of a mirror or
619.No raidz
620then all devices within that
621.No mirror/ Ns No raidz
622group must be expanded before the new space is made available to
623the pool. The default behavior is
624.Qq off .
625This property can also be referred to by its shortened column name,
626.Sy expand .
627.It Sy autoreplace Ns = Ns Cm on No | Cm off
628Controls automatic device replacement. If set to
629.Qq Cm off ,
630device replacement must be initiated by the administrator by using the
631.Qq Nm Cm replace
632command. If set to
633.Qq Cm on ,
634any new device, found in the same
635physical location as a device that previously belonged to the pool, is
636automatically formatted and replaced. The default behavior is
637.Qq Cm off .
638This property can also be referred to by its shortened column name, "replace".
639.It Sy bootfs Ns = Ns Ar pool Ns / Ns Ar dataset
640Identifies the default bootable dataset for the root pool. This property is
641expected to be set mainly by the installation and upgrade programs.
642.It Sy cachefile Ns = Ns Ar path No | Cm none
643Controls the location of where the pool configuration is cached. Discovering
644all pools on system startup requires a cached copy of the configuration data
645that is stored on the root file system. All pools in this cache are
646automatically imported when the system boots. Some environments, such as
647install and clustering, need to cache this information in a different location
648so that pools are not automatically imported. Setting this property caches the
649pool configuration in a different location that can later be imported with
650.Qq Nm Cm import Fl c .
651Setting it to the special value
652.Qq Cm none
653creates a temporary pool that is never cached, and the special value
654.Cm ''
655(empty string) uses the default location.
656.It Sy dedupditto Ns = Ns Ar number
657Threshold for the number of block ditto copies. If the reference count for a
658deduplicated block increases above this number, a new ditto copy of this block
659is automatically stored. Deafult setting is
660.Cm 0 .
661.It Sy delegation Ns = Ns Cm on No | Cm off
662Controls whether a non-privileged user is granted access based on the dataset
663permissions defined on the dataset. See
664.Xr zfs 8
665for more information on
666.Tn ZFS
667delegated administration.
668.It Sy failmode Ns = Ns Cm wait No | Cm continue No | Cm panic
669Controls the system behavior in the event of catastrophic pool failure. This
670condition is typically a result of a loss of connectivity to the underlying
671storage device(s) or a failure of all devices within the pool. The behavior of
672such an event is determined as follows:
673.Bl -tag -width indent
674.It Sy wait
675Blocks all
676.Tn I/O
677access until the device connectivity is recovered and the errors are cleared.
678This is the default behavior.
679.It Sy continue
680Returns
681.Em EIO
682to any new write
683.Tn I/O
684requests but allows reads to any of the remaining healthy devices. Any write
685requests that have yet to be committed to disk would be blocked.
686.It Sy panic
687Prints out a message to the console and generates a system crash dump.
688.El
689.It Sy listsnaps Ns = Ns Cm on No | Cm off
690Controls whether information about snapshots associated with this pool is
691output when
692.Qq Nm zfs Cm list
693is run without the
694.Fl t
695option. The default value is
696.Cm off .
697.It Sy version Ns = Ns Ar version
698The current on-disk version of the pool. This can be increased, but never
699decreased. The preferred method of updating pools is with the
700.Qq Nm Cm upgrade
701command, though this property can be used when a specific version is needed
702for backwards compatibility. This property can be any number between 1 and the
703current version reported by
704.Qo Ic zpool upgrade -v Qc .
705.El
706.Sh SUBCOMMANDS
707All subcommands that modify state are logged persistently to the pool in their
708original form.
709.Pp
710The
711.Nm
712command provides subcommands to create and destroy storage pools, add capacity
713to storage pools, and provide information about the storage pools. The following
714subcommands are supported:
715.Bl -tag -width 2n
716.It Xo
717.Nm
718.Op Fl \&?
719.Xc
720.Pp
721Displays a help message.
722.It Xo
723.Nm
724.Cm add
725.Op Fl fn
726.Ar pool vdev ...
727.Xc
728.Pp
729Adds the specified virtual devices to the given pool. The
730.No vdev
731specification is described in the
732.Qq Sx Virtual Devices
733section. The behavior of the
734.Fl f
735option, and the device checks performed are described in the
736.Qq Nm Cm create
737subcommand.
738.Bl -tag -width indent
739.It Fl f
740Forces use of
741.Ar vdev ,
742even if they appear in use or specify a conflicting replication level.
743Not all devices can be overridden in this manner.
744.It Fl n
745Displays the configuration that would be used without actually adding the
746.Ar vdev Ns s.
747The actual pool creation can still fail due to insufficient privileges or device
748sharing.
749.Pp
750Do not add a disk that is currently configured as a quorum device to a zpool.
751After a disk is in the pool, that disk can then be configured as a quorum
752device.
753.El
754.It Xo
755.Nm
756.Cm attach
757.Op Fl f
758.Ar pool device new_device
759.Xc
760.Pp
761Attaches
762.Ar new_device
763to an existing
764.Sy zpool
765device. The existing device cannot be part of a
766.No raidz
767configuration. If
768.Ar device
769is not currently part of a mirrored configuration,
770.Ar device
771automatically transforms into a two-way mirror of
772.Ar device No and Ar new_device .
773If
774.Ar device
775is part of a two-way mirror, attaching
776.Ar new_device
777creates a three-way mirror, and so on. In either case,
778.Ar new_device
779begins to resilver immediately.
780.Bl -tag -width indent
781.It Fl f
782Forces use of
783.Ar new_device ,
784even if its appears to be in use. Not all devices can be overridden in this
785manner.
786.El
787.It Xo
788.Nm
789.Cm clear
790.Op Fl F Op Fl n
791.Ar pool
792.Op Ar device
793.Xc
794.Pp
795Clears device errors in a pool. If no arguments are specified, all device
796errors within the pool are cleared. If one or more devices is specified, only
797those errors associated with the specified device or devices are cleared.
798.Bl -tag -width indent
799.It Fl F
800Initiates recovery mode for an unopenable pool. Attempts to discard the last
801few transactions in the pool to return it to an openable state. Not all damaged
802pools can be recovered by using this option. If successful, the data from the
803discarded transactions is irretrievably lost.
804.It Fl n
805Used in combination with the
806.Fl F
807flag. Check whether discarding transactions would make the pool openable, but
808do not actually discard any transactions.
809.El
810.It Xo
811.Nm
812.Cm create
813.Op Fl fn
814.Op Fl o Ar property Ns = Ns Ar value
815.Ar ...
816.Op Fl O Ar file-system-property Ns = Ns Ar value
817.Ar ...
818.Op Fl m Ar mountpoint
819.Op Fl R Ar root
820.Ar pool vdev ...
821.Xc
822.Pp
823Creates a new storage pool containing the virtual devices specified on the
824command line. The pool name must begin with a letter, and can only contain
825alphanumeric characters as well as underscore ("_"), dash ("-"), and period
826("."). The pool names "mirror", "raidz", "spare" and "log" are reserved, as are
827names beginning with the pattern "c[0-9]". The
828.No vdev
829specification is described in the
830.Qq Sx Virtual Devices
831section.
832.Pp
833The command verifies that each device specified is accessible and not currently
834in use by another subsystem. There are some uses, such as being currently
835mounted, or specified as the dedicated dump device, that prevents a device from
836ever being used by
837.Tn ZFS
838Other uses, such as having a preexisting
839.Sy UFS
840file system, can be overridden with the
841.Fl f
842option.
843.Pp
844The command also checks that the replication strategy for the pool is
845consistent. An attempt to combine redundant and non-redundant storage in a
846single pool, or to mix disks and files, results in an error unless
847.Fl f
848is specified. The use of differently sized devices within a single
849.No raidz
850or mirror group is also flagged as an error unless
851.Fl f
852is specified.
853.Pp
854Unless the
855.Fl R
856option is specified, the default mount point is
857.Qq Pa /pool .
858The mount point must not exist or must be empty, or else the
859root dataset cannot be mounted. This can be overridden with the
860.Fl m
861option.
862.Bl -tag -width indent
863.It Fl f
864Forces use of
865.Ar vdev Ns s,
866even if they appear in use or specify a conflicting replication level.
867Not all devices can be overridden in this manner.
868.It Fl n
869Displays the configuration that would be used without actually creating the
870pool. The actual pool creation can still fail due to insufficient privileges or
871device sharing.
872.It Xo
873.Fl o Ar property Ns = Ns Ar value
874.Op Fl o Ar property Ns = Ns Ar value
875.Ar ...
876.Xc
877Sets the given pool properties. See the
878.Qq Sx Properties
879section for a list of valid properties that can be set.
880.It Xo
881.Fl O
882.Ar file-system-property Ns = Ns Ar value
883.Op Fl O Ar file-system-property Ns = Ns Ar value
884.Ar ...
885.Xc
886Sets the given file system properties in the root file system of the pool. See
887.Xr zfs 8 Properties
888for a list of valid properties that
889can be set.
890.It Fl R Ar root
891Equivalent to
892.Qq Fl o Cm cachefile=none,altroot= Ns Pa root
893.It Fl m Ar mountpoint
894Sets the mount point for the root dataset. The default mount point is
895.Qq Pa /pool
896or
897.Qq Cm altroot Ns Pa /pool
898if
899.Sy altroot
900is specified. The mount point must be an absolute path,
901.Qq Cm legacy ,
902or
903.Qq Cm none .
904For more information on dataset mount points, see
905.Xr zfs 8 .
906.El
907.It Xo
908.Nm
909.Cm destroy
910.Op Fl f
911.Ar pool
912.Xc
913.Pp
914Destroys the given pool, freeing up any devices for other use. This command
915tries to unmount any active datasets before destroying the pool.
916.Bl -tag -width indent
917.It Fl f
918Forces any active datasets contained within the pool to be unmounted.
919.El
920.It Xo
921.Nm
922.Cm detach
923.Ar pool device
924.Xc
925.Pp
926Detaches
927.Ar device
928from a mirror. The operation is refused if there are no other valid replicas
929of the data.
930.It Xo
931.Nm
932.Cm export
933.Op Fl f
934.Ar pool ...
935.Xc
936.Pp
937Exports the given pools from the system. All devices are marked as exported,
938but are still considered in use by other subsystems. The devices can be moved
939between systems (even those of different endianness) and imported as long as a
940sufficient number of devices are present.
941.Pp
942Before exporting the pool, all datasets within the pool are unmounted. A pool
943can not be exported if it has a shared spare that is currently being used.
944.Pp
945For pools to be portable, you must give the
946.Nm
947command whole disks, not just slices, so that
948.Tn ZFS
949can label the disks with portable
950.Sy EFI
951labels. Otherwise, disk drivers on platforms of different endianness will not
952recognize the disks.
953.Bl -tag -width indent
954.It Fl f
955Forcefully unmount all datasets, using the
956.Qq Nm unmount Fl f
957command.
958.Pp
959This command will forcefully export the pool even if it has a shared spare that
960is currently being used. This may lead to potential data corruption.
961.El
962.It Xo
963.Nm
964.Cm get
965.Ar all | property Ns Op , Ns Ar ...
966.Ar pool ...
967.Xc
968.Pp
969Retrieves the given list of properties (or all properties if
970.Qq Cm all
971is used) for the specified storage pool(s). These properties are displayed with
972the following fields:
973.Bl -column -offset indent "property"
974.It name Ta Name of storage pool
975.It property Ta Property name
976.It value Ta Property value
977.It source Ta Property source, either 'default' or 'local'.
978.El
979.Pp
980See the
981.Qq Sx Properties
982section for more information on the available pool properties.
983.It Xo
984.Nm
985.Cm history
986.Op Fl il
987.Op Ar pool
988.Ar ...
989.Xc
990.Pp
991Displays the command history of the specified pools or all pools if no pool is
992specified.
993.Bl -tag -width indent
994.It Fl i
995Displays internally logged
996.Tn ZFS
997events in addition to user initiated events.
998.It Fl l
999Displays log records in long format, which in addition to standard format
1000includes, the user name, the hostname, and the zone in which the operation was
1001performed.
1002.El
1003.It Xo
1004.Nm
1005.Cm import
1006.Op Fl d Ar dir | Fl c Ar cachefile
1007.Op Fl D
1008.Xc
1009.Pp
1010Lists pools available to import. If the
1011.Fl d
1012option is not specified, this command searches for devices in
1013.Qq Pa /dev .
1014The
1015.Fl d
1016option can be specified multiple times, and all directories are searched. If
1017the device appears to be part of an exported pool, this command displays a
1018summary of the pool with the name of the pool, a numeric identifier, as well as
1019the
1020.No vdev
1021layout and current health of the device for each device or file.
1022Destroyed pools, pools that were previously destroyed with the
1023.Qq Nm Cm destroy
1024command, are not listed unless the
1025.Fl D
1026option is specified.
1027.Pp
1028The numeric identifier is unique, and can be used instead of the pool name when
1029multiple exported pools of the same name are available.
1030.Bl -tag -width indent
1031.It Fl c Ar cachefile
1032Reads configuration from the given
1033.Ar cachefile
1034that was created with the
1035.Qq Sy cachefile
1036pool property. This
1037.Ar cachefile
1038is used instead of searching for devices.
1039.It Fl d Ar dir
1040Searches for devices or files in
1041.Ar dir .
1042The
1043.Fl d
1044option can be specified multiple times.
1045.It Fl D
1046Lists destroyed pools only.
1047.El
1048.It Xo
1049.Nm
1050.Cm import
1051.Op Fl o Ar mntopts
1052.Op Fl o Ar property Ns = Ns Ar value
1053.Ar ...
1054.Op Fl d Ar dir | Fl c Ar cachefile
1055.Op Fl D
1056.Op Fl f
1057.Op Fl m
1058.Op Fl N
1059.Op Fl R Ar root
1060.Op Fl F Op Fl n
1061.Fl a
1062.Xc
1063.Pp
1064Imports all pools found in the search directories. Identical to the previous
1065command, except that all pools with a sufficient number of devices available
1066are imported. Destroyed pools, pools that were previously destroyed with the
1067.Qq Nm Cm destroy
1068command, will not be imported unless the
1069.Fl D
1070option is specified.
1071.Bl -tag -width indent
1072.It Fl o Ar mntopts
1073Comma-separated list of mount options to use when mounting datasets within the
1074pool. See
1075.Xr zfs 8
1076for a description of dataset properties and mount options.
1077.It Fl o Ar property Ns = Ns Ar value
1078Sets the specified property on the imported pool. See the
1079.Qq Sx Properties
1080section for more information on the available pool properties.
1081.It Fl c Ar cachefile
1082Reads configuration from the given
1083.Ar cachefile
1084that was created with the
1085.Qq Sy cachefile
1086pool property. This
1087.Ar cachefile
1088is used instead of searching for devices.
1089.It Fl d Ar dir
1090Searches for devices or files in
1091.Ar dir .
1092The
1093.Fl d
1094option can be specified multiple times. This option is incompatible with the
1095.Fl c
1096option.
1097.It Fl D
1098Imports destroyed pools only. The
1099.Fl f
1100option is also required.
1101.It Fl f
1102Forces import, even if the pool appears to be potentially active.
1103.It Fl m
1104Enables import with missing log devices.
1105.It Fl N
1106Do not mount any filesystems from the imported pool.
1107.It Fl R Ar root
1108Sets the
1109.Qq Sy cachefile
1110property to
1111.Qq Cm none
1112and the
1113.Qq Sy altroot
1114property to
1115.Qq Ar root
1116.It Fl F
1117Recovery mode for a non-importable pool. Attempt to return the pool to an
1118importable state by discarding the last few transactions. Not all damaged pools
1119can be recovered by using this option. If successful, the data from the
1120discarded transactions is irretrievably lost. This option is ignored if the
1121pool is importable or already imported.
1122.It Fl n
1123Used with the
1124.Fl F
1125recovery option. Determines whether a non-importable pool can be made
1126importable again, but does not actually perform the pool recovery. For more
1127details about pool recovery mode, see the
1128.Fl F
1129option, above.
1130.It Fl a
1131Searches for and imports all pools found.
1132.El
1133.It Xo
1134.Nm
1135.Cm import
1136.Op Fl o Ar mntopts
1137.Op Fl o Ar property Ns = Ns Ar value
1138.Ar ...
1139.Op Fl d Ar dir | Fl c Ar cachefile
1140.Op Fl D
1141.Op Fl f
1142.Op Fl m
1143.Op Fl N
1144.Op Fl R Ar root
1145.Op Fl F Op Fl n
1146.Ar pool | id
1147.Op Ar newpool
1148.Xc
1149.Pp
1150Imports a specific pool. A pool can be identified by its name or the numeric
1151identifier. If
1152.Ar newpool
1153is specified, the pool is imported using the name
1154.Ar newpool .
1155Otherwise, it is imported with the same name as its exported name.
1156.Pp
1157If a device is removed from a system without running
1158.Qq Nm Cm export
1159first, the device appears as potentially active. It cannot be determined if
1160this was a failed export, or whether the device is really in use from another
1161host. To import a pool in this state, the
1162.Fl f
1163option is required.
1164.Bl -tag -width indent
1165.It Fl o Ar mntopts
1166Comma-separated list of mount options to use when mounting datasets within the
1167pool. See
1168.Xr zfs 8
1169for a description of dataset properties and mount options.
1170.It Fl o Ar property Ns = Ns Ar value
1171Sets the specified property on the imported pool. See the
1172.Qq Sx Properties
1173section for more information on the available pool properties.
1174.It Fl c Ar cachefile
1175Reads configuration from the given
1176.Ar cachefile
1177that was created with the
1178.Qq Sy cachefile
1179pool property. This
1180.Ar cachefile
1181is used instead of searching for devices.
1182.It Fl d Ar dir
1183Searches for devices or files in
1184.Ar dir .
1185The
1186.Fl d
1187option can be specified multiple times. This option is incompatible with the
1188.Fl c
1189option.
1190.It Fl D
1191Imports destroyed pools only. The
1192.Fl f
1193option is also required.
1194.It Fl f
1195Forces import, even if the pool appears to be potentially active.
1196.It Fl m
1197Enables import with missing log devices.
1198.It Fl N
1199Do not mount any filesystems from the imported pool.
1200.It Fl R Ar root
1201Equivalent to
1202.Qq Fl o Cm cachefile=none,altroot= Ns Pa root
1203.It Fl F
1204Recovery mode for a non-importable pool. Attempt to return the pool to an
1205importable state by discarding the last few transactions. Not all damaged pools
1206can be recovered by using this option. If successful, the data from the
1207discarded transactions is irretrievably lost. This option is ignored if the
1208pool is importable or already imported.
1209.It Fl n
1210Used with the
1211.Fl F
1212recovery option. Determines whether a non-importable pool can be made
1213importable again, but does not actually perform the pool recovery. For more
1214details about pool recovery mode, see the
1215.Fl F
1216option, above.
1217.El
1218.It Xo
1219.Nm
1220.Cm iostat
1221.Op Fl T Cm d Ns | Ns Cm u
1222.Op Fl v
1223.Op Ar pool
1224.Ar ...
1225.Op Ar interval Op Ar count
1226.Xc
1227.Pp
1228Displays
1229.Tn I/O
1230statistics for the given pools. When given an interval, the statistics are
1231printed every
1232.Ar interval
1233seconds until
1234.Sy Ctrl-C
1235is pressed. If no
1236.Ar pools
1237are specified, statistics for every pool in the system is shown. If
1238.Ar count
1239is specified, the command exits after
1240.Ar count
1241reports are printed.
1242.Bl -tag -width indent
1243.It Fl T Cm d Ns | Ns Cm u
1244Print a timestamp.
1245.Pp
1246Use modifier
1247.Cm d
1248for standard date format. See
1249.Xr date 1 .
1250Use modifier
1251.Cm u
1252for unixtime
1253.Pq equals Qq Ic date +%s .
1254.It Fl v
1255Verbose statistics. Reports usage statistics for individual
1256.No vdev Ns s
1257within the pool, in addition to the pool-wide statistics.
1258.El
1259.It Xo
1260.Nm
1261.Cm labelclear
1262.Op Fl f
1263.Ar device
1264.Xc
1265.Pp
1266Removes
1267.Tn ZFS
1268label information from the specified
1269.Ar device .
1270The
1271.Ar device
1272must not be part of an active pool configuration.
1273.Bl -tag -width indent
1274.It Fl v
1275Treat exported or foreign devices as inactive.
1276.El
1277.It Xo
1278.Nm
1279.Cm list
1280.Op Fl Hv
1281.Op Fl o Ar property Ns Op , Ns Ar ...
1282.Op Fl T Cm d Ns | Ns Cm u
1283.Op Ar pool
1284.Ar ...
1285.Op Ar inverval Op Ar count
1286.Xc
1287.Pp
1288Lists the given pools along with a health status and space usage. When given no
1289arguments, all pools in the system are listed.
1290.Pp
1291When given an interval, the output is printed every
1292.Ar interval
1293seconds until
1294.Sy Ctrl-C
1295is pressed. If
1296.Ar count
1297is specified, the command exits after
1298.Ar count
1299reports are printed.
1300.Bl -tag -width indent
1301.It Fl H
1302Scripted mode. Do not display headers, and separate fields by a single tab
1303instead of arbitrary space.
1304.It Fl o Ar property Ns Op , Ns Ar ...
1305Comma-separated list of properties to display. See the
1306.Qq Sx Properties
1307section for a list of valid properties. The default list is
1308.Sy name ,
1309.Sy size ,
1310.Sy used ,
1311.Sy available ,
1312.Sy capacity ,
1313.Sy health ,
1314.Sy altroot .
1315.It Fl T Cm d Ns | Ns Cm u
1316Print a timestamp.
1317.Pp
1318Use modifier
1319.Cm d
1320for standard date format. See
1321.Xr date 1 .
1322Use modifier
1323.Cm u
1324for unixtime
1325.Pq equals Qq Ic date +%s .
1326.El
1327.It Xo
1328.Nm
1329.Cm offline
1330.Op Fl t
1331.Ar pool device ...
1332.Xc
1333.Pp
1334Takes the specified physical device offline. While the
1335.Ar device
1336is offline, no attempt is made to read or write to the device.
1337.Bl -tag -width indent
1338.It Fl t
1339Temporary. Upon reboot, the specified physical device reverts to its previous
1340state.
1341.El
1342.It Xo
1343.Nm
1344.Cm online
1345.Op Fl e
1346.Ar pool device ...
1347.Xc
1348.Pp
1349Brings the specified physical device online.
1350.Pp
1351This command is not applicable to spares or cache devices.
1352.Bl -tag -width indent
1353.It Fl e
1354Expand the device to use all available space. If the device is part of a mirror
1355or
1356.No raidz
1357then all devices must be expanded before the new space will become
1358available to the pool.
1359.El
1360.It Xo
1361.Nm
1362.Cm reguid
1363.Ar pool
1364.Xc
1365.Pp
1366Generates a new unique identifier for the pool. You must ensure that all
1367devices in this pool are online and healthy before performing this action.
1368.It Xo
1369.Nm
1370.Cm remove
1371.Ar pool device ...
1372.Xc
1373.Pp
1374Removes the specified device from the pool. This command currently only
1375supports removing hot spares, cache, and log devices. A mirrored log device can
1376be removed by specifying the top-level mirror for the log. Non-log devices that
1377are part of a mirrored configuration can be removed using the
1378.Qq Nm Cm detach
1379command. Non-redundant and
1380.No raidz
1381devices cannot be removed from a pool.
1382.It Xo
1383.Nm
1384.Cm replace
1385.Op Fl f
1386.Ar pool device
1387.Op Ar new_device
1388.Xc
1389.Pp
1390Replaces
1391.Ar old_device
1392with
1393.Ar new_device .
1394This is equivalent to attaching
1395.Ar new_device ,
1396waiting for it to resilver, and then detaching
1397.Ar old_device .
1398.Pp
1399The size of
1400.Ar new_device
1401must be greater than or equal to the minimum size
1402of all the devices in a mirror or
1403.No raidz
1404configuration.
1405.Pp
1406.Ar new_device
1407is required if the pool is not redundant. If
1408.Ar new_device
1409is not specified, it defaults to
1410.Ar old_device .
1411This form of replacement is useful after an existing disk has failed and has
1412been physically replaced. In this case, the new disk may have the same
1413.Pa /dev
1414path as the old device, even though it is actually a different disk.
1415.Tn ZFS
1416recognizes this.
1417.Bl -tag -width indent
1418.It Fl f
1419Forces use of
1420.Ar new_device ,
1421even if its appears to be in use. Not all devices can be overridden in this
1422manner.
1423.El
1424.It Xo
1425.Nm
1426.Cm scrub
1427.Op Fl s
1428.Ar pool ...
1429.Xc
1430.Pp
1431Begins a scrub. The scrub examines all data in the specified pools to verify
1432that it checksums correctly. For replicated (mirror or
1433.No raidz )
1434devices,
1435.Tn ZFS
1436automatically repairs any damage discovered during the scrub. The
1437.Qq Nm Cm status
1438command reports the progress of the scrub and summarizes the results of the
1439scrub upon completion.
1440.Pp
1441Scrubbing and resilvering are very similar operations. The difference is that
1442resilvering only examines data that
1443.Tn ZFS
1444knows to be out of date (for example, when attaching a new device to a mirror
1445or replacing an existing device), whereas scrubbing examines all data to
1446discover silent errors due to hardware faults or disk failure.
1447.Pp
1448Because scrubbing and resilvering are
1449.Tn I/O Ns -intensive
1450operations,
1451.Tn ZFS
1452only allows one at a time. If a scrub is already in progress, the
1453.Qq Nm Cm scrub
1454command returns an error. To start a new scrub, you have to stop the old scrub
1455with the
1456.Qq Nm Cm scrub Fl s
1457command first. If a resilver is in progress,
1458.Tn ZFS
1459does not allow a scrub to be started until the resilver completes.
1460.Bl -tag -width indent
1461.It Fl s
1462Stop scrubbing.
1463.El
1464.It Xo
1465.Nm
1466.Cm set
1467.Ar property Ns = Ns Ar value pool
1468.Xc
1469.Pp
1470Sets the given property on the specified pool. See the
1471.Qq Sx Properties
1472section for more information on what properties can be set and acceptable
1473values.
1474.It Xo
1475.Nm
1476.Cm split
1477.Op Fl n
1478.Op Fl R Ar altroot
1479.Op Fl o Ar mntopts
1480.Op Fl o Ar property Ns = Ns Ar value
1481.Ar pool newpool
1482.Op Ar device ...
1483.Xc
1484.Pp
1485Splits off one disk from each mirrored top-level
1486.No vdev
1487in a pool and creates a new pool from the split-off disks. The original pool
1488must be made up of one or more mirrors and must not be in the process of
1489resilvering. The
1490.Cm split
1491subcommand chooses the last device in each mirror
1492.No vdev
1493unless overridden by a device specification on the command line.
1494.Pp
1495When using a
1496.Ar device
1497argument,
1498.Cm split
1499includes the specified device(s) in a new pool and, should any devices remain
1500unspecified, assigns the last device in each mirror
1501.No vdev
1502to that pool, as it does normally. If you are uncertain about the outcome of a
1503.Cm split
1504command, use the
1505.Fl n
1506("dry-run") option to ensure your command will have the effect you intend.
1507.Bl -tag -width indent
1508.It Fl R Ar altroot
1509Automatically import the newly created pool after splitting, using the
1510specified
1511.Ar altroot
1512parameter for the new pool's alternate root. See the
1513.Sy altroot
1514description in the
1515.Qq Sx Properties
1516section, above.
1517.It Fl n
1518Displays the configuration that would be created without actually splitting the
1519pool. The actual pool split could still fail due to insufficient privileges or
1520device status.
1521.It Fl o Ar mntopts
1522Comma-separated list of mount options to use when mounting datasets within the
1523pool. See
1524.Xr zfs 8
1525for a description of dataset properties and mount options. Valid only in
1526conjunction with the
1527.Fl R
1528option.
1529.It Fl o Ar property Ns = Ns Ar value
1530Sets the specified property on the new pool. See the
1531.Qq Sx Properties
1532section, above, for more information on the available pool properties.
1533.El
1534.It Xo
1535.Nm
1536.Cm status
1537.Op Fl vx
1538.Op Fl T Cm d Ns | Ns Cm u
1539.Op Ar pool
1540.Ar ...
1541.Op Ar interval Op Ar count
1542.Xc
1543.Pp
1544Displays the detailed health status for the given pools. If no
1545.Ar pool
1546is specified, then the status of each pool in the system is displayed. For more
1547information on pool and device health, see the
1548.Qq Sx Device Failure and Recovery
1549section.
1550.Pp
1551When given an interval, the output is printed every
1552.Ar interval
1553seconds until
1554.Sy Ctrl-C
1555is pressed. If
1556.Ar count
1557is specified, the command exits after
1558.Ar count
1559reports are printed.
1560.Pp
1561If a scrub or resilver is in progress, this command reports the percentage done
1562and the estimated time to completion. Both of these are only approximate,
1563because the amount of data in the pool and the other workloads on the system
1564can change.
1565.Bl -tag -width indent
1566.It Fl x
1567Only display status for pools that are exhibiting errors or are otherwise
1568unavailable.
1569.It Fl v
1570Displays verbose data error information, printing out a complete list of all
1571data errors since the last complete pool scrub.
1572.It Fl T Cm d Ns | Ns Cm u
1573Print a timestamp.
1574.Pp
1575Use modifier
1576.Cm d
1577for standard date format. See
1578.Xr date 1 .
1579Use modifier
1580.Cm u
1581for unixtime
1582.Pq equals Qq Ic date +%s .
1583.El
1584.It Xo
1585.Nm
1586.Cm upgrade
1587.Op Fl v
1588.Xc
1589.Pp
1590Displays all pools formatted using a different
1591.Tn ZFS
1592pool on-disk version. Older versions can continue to be used, but some
1593features may not be available. These pools can be upgraded using
1594.Qq Nm Cm upgrade Fl a .
1595Pools that are formatted with a more recent version are also displayed,
1596although these pools will be inaccessible on the system.
1597.Bl -tag -width indent
1598.It Fl v
1599Displays
1600.Tn ZFS
1601pool versions supported by the current software. The current
1602.Tn ZFS
1603pool version and all previous supported versions are displayed, along
1604with an explanation of the features provided with each version.
1605.El
1606.It Xo
1607.Nm
1608.Cm upgrade
1609.Op Fl V Ar version
1610.Fl a | Ar pool ...
1611.Xc
1612.Pp
1613Upgrades the given pool to the latest on-disk pool version. Once this is done,
1614the pool will no longer be accessible on systems running older versions of the
1615software.
1616.Bl -tag -width indent
1617.It Fl a
1618Upgrades all pools.
1619.It Fl V Ar version
1620Upgrade to the specified version. If the
1621.Fl V
1622flag is not specified, the pool is upgraded to the most recent version. This
1623option can only be used to increase the version number, and only up to the most
1624recent version supported by this software.
1625.El
1626.El
1627.Sh EXAMPLES
1628.Bl -tag -width 0n
1629.It Sy Example 1 No Creating a RAID-Z Storage Pool
1630.Pp
1631The following command creates a pool with a single
1632.No raidz
1633root
1634.No vdev
1635that consists of six disks.
1636.Bd -literal -offset 2n
1637.Li # Ic zpool create tank raidz da0 da1 da2 da3 da4 da5
1638.Ed
1639.It Sy Example 2 No Creating a Mirrored Storage Pool
1640.Pp
1641The following command creates a pool with two mirrors, where each mirror
1642contains two disks.
1643.Bd -literal -offset 2n
1644.Li # Ic zpool create tank mirror da0 da1 mirror da2 da3
1645.Ed
1646.It Sy Example 3 No Creating a Tn ZFS No Storage Pool by Using Partitions
1647.Pp
1648The following command creates an unmirrored pool using two GPT partitions.
1649.Bd -literal -offset 2n
1650.Li # Ic zpool create tank da0p3 da1p3
1651.Ed
1652.It Sy Example 4 No Creating a Tn ZFS No Storage Pool by Using Files
1653.Pp
1654The following command creates an unmirrored pool using files. While not
1655recommended, a pool based on files can be useful for experimental purposes.
1656.Bd -literal -offset 2n
1657.Li # Ic zpool create tank /path/to/file/a /path/to/file/b
1658.Ed
1659.It Sy Example 5 No Adding a Mirror to a Tn ZFS No Storage Pool
1660.Pp
1661The following command adds two mirrored disks to the pool
1662.Em tank ,
1663assuming the pool is already made up of two-way mirrors. The additional space
1664is immediately available to any datasets within the pool.
1665.Bd -literal -offset 2n
1666.Li # Ic zpool add tank mirror da2 da3
1667.Ed
1668.It Sy Example 6 No Listing Available Tn ZFS No Storage Pools
1669.Pp
1670The following command lists all available pools on the system.
1671.Bd -literal -offset 2n
1672.Li # Ic zpool list
1673NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT
1674pool 2.70T 473G 2.24T 17% 1.00x ONLINE -
1675test 1.98G 89.5K 1.98G 0% 1.00x ONLINE -
1676.Ed
1677.It Sy Example 7 No Listing All Properties for a Pool
1678.Pp
1679The following command lists all the properties for a pool.
1680.Bd -literal -offset 2n
1681.Li # Ic zpool get all pool
1682pool size 2.70T -
1683pool capacity 17% -
1684pool altroot - default
1685pool health ONLINE -
1686pool guid 2501120270416322443 default
1687pool version 28 default
1688pool bootfs pool/root local
1689pool delegation on default
1690pool autoreplace off default
1691pool cachefile - default
1692pool failmode wait default
1693pool listsnapshots off default
1694pool autoexpand off default
1695pool dedupditto 0 default
1696pool dedupratio 1.00x -
1697pool free 2.24T -
1698pool allocated 473G -
1699pool readonly off -
1700.Ed
1701.It Sy Example 8 No Destroying a Tn ZFS No Storage Pool
1702.Pp
1703The following command destroys the pool
1704.Qq Em tank
1705and any datasets contained within.
1706.Bd -literal -offset 2n
1707.Li # Ic zpool destroy -f tank
1708.Ed
1709.It Sy Example 9 No Exporting a Tn ZFS No Storage Pool
1710.Pp
1711The following command exports the devices in pool
1712.Em tank
1713so that they can be relocated or later imported.
1714.Bd -literal -offset 2n
1715.Li # Ic zpool export tank
1716.Ed
1717.It Sy Example 10 No Importing a Tn ZFS No Storage Pool
1718.Pp
1719The following command displays available pools, and then imports the pool
1720.Qq Em tank
1721for use on the system.
1722.Pp
1723The results from this command are similar to the following:
1724.Bd -literal -offset 2n
1725.Li # Ic zpool import
1726
1727 pool: tank
1728 id: 15451357997522795478
1729 state: ONLINE
1730action: The pool can be imported using its name or numeric identifier.
1731config:
1732
1733 tank ONLINE
1734 mirror ONLINE
1735 da0 ONLINE
1736 da1 ONLINE
1737.Ed
1738.It Xo
1739.Sy Example 11
1740Upgrading All
1741.Tn ZFS
1742Storage Pools to the Current Version
1743.Xc
1744.Pp
1745The following command upgrades all
1746.Tn ZFS
1747Storage pools to the current version of
1748the software.
1749.Bd -literal -offset 2n
1750.Li # Ic zpool upgrade -a
1751This system is currently running ZFS pool version 28.
1752.Ed
1753.It Sy Example 12 No Managing Hot Spares
1754.Pp
1755The following command creates a new pool with an available hot spare:
1756.Bd -literal -offset 2n
1757.Li # Ic zpool create tank mirror da0 da1 spare da2
1758.Ed
1759.Pp
1760If one of the disks were to fail, the pool would be reduced to the degraded
1761state. The failed device can be replaced using the following command:
1762.Bd -literal -offset 2n
1763.Li # Ic zpool replace tank da0 da2
1764.Ed
1765.Pp
1766Once the data has been resilvered, the spare is automatically removed and is
1767made available should another device fails. The hot spare can be permanently
1768removed from the pool using the following command:
1769.Bd -literal -offset 2n
1770.Li # Ic zpool remove tank da2
1771.Ed
1772.It Xo
1773.Sy Example 13
1774Creating a
1775.Tn ZFS
1776Pool with Mirrored Separate Intent Logs
1777.Xc
1778.Pp
1779The following command creates a
1780.Tn ZFS
1781storage pool consisting of two, two-way
1782mirrors and mirrored log devices:
1783.Bd -literal -offset 2n
1784.Li # Ic zpool create pool mirror da0 da1 mirror da2 da3 log mirror da4 da5
1785.Ed
1786.It Sy Example 14 No Adding Cache Devices to a Tn ZFS No Pool
1787.Pp
1788The following command adds two disks for use as cache devices to a
1789.Tn ZFS
1790storage pool:
1791.Bd -literal -offset 2n
1792.Li # Ic zpool add pool cache da2 da3
1793.Ed
1794.Pp
1795Once added, the cache devices gradually fill with content from main memory.
1796Depending on the size of your cache devices, it could take over an hour for
1797them to fill. Capacity and reads can be monitored using the
1798.Cm iostat
1799subcommand as follows:
1800.Bd -literal -offset 2n
1801.Li # Ic zpool iostat -v pool 5
1802.Ed
1803.It Sy Example 15 No Removing a Mirrored Log Device
1804.Pp
1805The following command removes the mirrored log device
1806.Em mirror-2 .
1807.Pp
1808Given this configuration:
1809.Bd -literal -offset 2n
1810 pool: tank
1811 state: ONLINE
1812 scrub: none requested
1813 config:
1814
1815 NAME STATE READ WRITE CKSUM
1816 tank ONLINE 0 0 0
1817 mirror-0 ONLINE 0 0 0
1818 da0 ONLINE 0 0 0
1819 da1 ONLINE 0 0 0
1820 mirror-1 ONLINE 0 0 0
1821 da2 ONLINE 0 0 0
1822 da3 ONLINE 0 0 0
1823 logs
1824 mirror-2 ONLINE 0 0 0
1825 da4 ONLINE 0 0 0
1826 da5 ONLINE 0 0 0
1827.Ed
1828.Pp
1829The command to remove the mirrored log
1830.Em mirror-2
1831is:
1832.Bd -literal -offset 2n
1833.Li # Ic zpool remove tank mirror-2
1834.Ed
1835.It Sy Example 16 No Recovering a Faulted Tn ZFS No Pool
1836.Pp
1837If a pool is faulted but recoverable, a message indicating this state is
1838provided by
1839.Qq Nm Cm status
1840if the pool was cached (see the
1841.Fl c Ar cachefile
1842argument above), or as part of the error output from a failed
1843.Qq Nm Cm import
1844of the pool.
1845.Pp
1846Recover a cached pool with the
1847.Qq Nm Cm clear
1848command:
1849.Bd -literal -offset 2n
1850.Li # Ic zpool clear -F data
1851Pool data returned to its state as of Tue Sep 08 13:23:35 2009.
1852Discarded approximately 29 seconds of transactions.
1853.Ed
1854.Pp
1855If the pool configuration was not cached, use
1856.Qq Nm Cm import
1857with the recovery mode flag:
1858.Bd -literal -offset 2n
1859.Li # Ic zpool import -F data
1860Pool data returned to its state as of Tue Sep 08 13:23:35 2009.
1861Discarded approximately 29 seconds of transactions.
1862.Ed
1863.El
1864.Sh EXIT STATUS
1865The following exit values are returned:
1866.Bl -tag -offset 2n -width 2n
1867.It 0
1868Successful completion.
1869.It 1
1870An error occurred.
1871.It 2
1872Invalid command line options were specified.
1873.El
1874.Sh SEE ALSO
1875.Xr zfs 8
1876.Sh AUTHORS
1877This manual page is a
1878.Xr mdoc 7
1879reimplementation of the
1880.Tn OpenSolaris
1881manual page
1882.Em zpool(1M) ,
1883modified and customized for
1884.Fx
1885and licensed under the Common Development and Distribution License
1886.Pq Tn CDDL .
1887.Pp
1888The
1889.Xr mdoc 7
1890implementation of this manual page was initially written by
1891.An Martin Matuska Aq mm@FreeBSD.org .