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