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