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