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