]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/blob - cddl/contrib/opensolaris/cmd/zpool/zpool.8
MFC r263459 (MFV 263436-263438):
[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 March 20, 2014
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 .Pp
628 This property can also be referred to by its shortened column name,
629 .Sy rdonly .
630 .El
631 .Pp
632 The following properties can be set at creation time and import time, and later
633 changed with the
634 .Ic zpool set
635 command:
636 .Bl -tag -width 2n
637 .It Sy autoexpand Ns = Ns Cm on No | Cm off
638 Controls automatic pool expansion when the underlying LUN is grown. If set to
639 .Qq Cm on ,
640 the pool will be resized according to the size of the expanded
641 device. If the device is part of a mirror or
642 .No raidz
643 then all devices within that
644 .No mirror/ Ns No raidz
645 group must be expanded before the new space is made available to
646 the pool. The default behavior is
647 .Qq off .
648 This property can also be referred to by its shortened column name,
649 .Sy expand .
650 .It Sy autoreplace Ns = Ns Cm on No | Cm off
651 Controls automatic device replacement. If set to
652 .Qq Cm off ,
653 device replacement must be initiated by the administrator by using the
654 .Qq Nm Cm replace
655 command. If set to
656 .Qq Cm on ,
657 any new device, found in the same
658 physical location as a device that previously belonged to the pool, is
659 automatically formatted and replaced. The default behavior is
660 .Qq Cm off .
661 This property can also be referred to by its shortened column name, "replace".
662 .It Sy bootfs Ns = Ns Ar pool Ns / Ns Ar dataset
663 Identifies the default bootable dataset for the root pool. This property is
664 expected to be set mainly by the installation and upgrade programs.
665 .It Sy cachefile Ns = Ns Ar path No | Cm none
666 Controls the location of where the pool configuration is cached. Discovering
667 all pools on system startup requires a cached copy of the configuration data
668 that is stored on the root file system. All pools in this cache are
669 automatically imported when the system boots. Some environments, such as
670 install and clustering, need to cache this information in a different location
671 so that pools are not automatically imported. Setting this property caches the
672 pool configuration in a different location that can later be imported with
673 .Qq Nm Cm import Fl c .
674 Setting it to the special value
675 .Qq Cm none
676 creates a temporary pool that is never cached, and the special value
677 .Cm ''
678 (empty string) uses the default location.
679 .It Sy comment Ns = Ns Ar text
680 A text string consisting of printable ASCII characters that will be stored
681 such that it is available even if the pool becomes faulted.
682 An administrator can provide additional information about a pool using this
683 property.
684 .It Sy dedupditto Ns = Ns Ar number
685 Threshold for the number of block ditto copies. If the reference count for a
686 deduplicated block increases above this number, a new ditto copy of this block
687 is automatically stored. Default setting is
688 .Cm 0
689 which causes no ditto copies to be created for deduplicated blocks.
690 The miniumum legal nonzero setting is 100.
691 .It Sy delegation Ns = Ns Cm on No | Cm off
692 Controls whether a non-privileged user is granted access based on the dataset
693 permissions defined on the dataset. See
694 .Xr zfs 8
695 for more information on
696 .Tn ZFS
697 delegated administration.
698 .It Sy failmode Ns = Ns Cm wait No | Cm continue No | Cm panic
699 Controls the system behavior in the event of catastrophic pool failure. This
700 condition is typically a result of a loss of connectivity to the underlying
701 storage device(s) or a failure of all devices within the pool. The behavior of
702 such an event is determined as follows:
703 .Bl -tag -width indent
704 .It Sy wait
705 Blocks all
706 .Tn I/O
707 access until the device connectivity is recovered and the errors are cleared.
708 This is the default behavior.
709 .It Sy continue
710 Returns
711 .Em EIO
712 to any new write
713 .Tn I/O
714 requests but allows reads to any of the remaining healthy devices. Any write
715 requests that have yet to be committed to disk would be blocked.
716 .It Sy panic
717 Prints out a message to the console and generates a system crash dump.
718 .El
719 .It Sy feature@ Ns Ar feature_name Ns = Ns Sy enabled
720 The value of this property is the current state of
721 .Ar feature_name .
722 The only valid value when setting this property is
723 .Sy enabled
724 which moves
725 .Ar feature_name
726 to the enabled state.
727 See
728 .Xr zpool-features 7
729 for details on feature states.
730 .It Sy listsnaps Ns = Ns Cm on No | Cm off
731 Controls whether information about snapshots associated with this pool is
732 output when
733 .Qq Nm zfs Cm list
734 is run without the
735 .Fl t
736 option. The default value is
737 .Cm off .
738 .It Sy version Ns = Ns Ar version
739 The current on-disk version of the pool. This can be increased, but never
740 decreased. The preferred method of updating pools is with the
741 .Qq Nm Cm upgrade
742 command, though this property can be used when a specific version is needed
743 for backwards compatibility.
744 Once feature flags is enabled on a pool this property will no longer have a
745 value.
746 .El
747 .Sh SUBCOMMANDS
748 All subcommands that modify state are logged persistently to the pool in their
749 original form.
750 .Pp
751 The
752 .Nm
753 command provides subcommands to create and destroy storage pools, add capacity
754 to storage pools, and provide information about the storage pools. The following
755 subcommands are supported:
756 .Bl -tag -width 2n
757 .It Xo
758 .Nm
759 .Op Fl \&?
760 .Xc
761 .Pp
762 Displays a help message.
763 .It Xo
764 .Nm
765 .Cm add
766 .Op Fl fn
767 .Ar pool vdev ...
768 .Xc
769 .Pp
770 Adds the specified virtual devices to the given pool. The
771 .No vdev
772 specification is described in the
773 .Qq Sx Virtual Devices
774 section. The behavior of the
775 .Fl f
776 option, and the device checks performed are described in the
777 .Qq Nm Cm create
778 subcommand.
779 .Bl -tag -width indent
780 .It Fl f
781 Forces use of
782 .Ar vdev ,
783 even if they appear in use or specify a conflicting replication level.
784 Not all devices can be overridden in this manner.
785 .It Fl n
786 Displays the configuration that would be used without actually adding the
787 .Ar vdev Ns s.
788 The actual pool creation can still fail due to insufficient privileges or device
789 sharing.
790 .Pp
791 Do not add a disk that is currently configured as a quorum device to a zpool.
792 After a disk is in the pool, that disk can then be configured as a quorum
793 device.
794 .El
795 .It Xo
796 .Nm
797 .Cm attach
798 .Op Fl f
799 .Ar pool device new_device
800 .Xc
801 .Pp
802 Attaches
803 .Ar new_device
804 to an existing
805 .Sy zpool
806 device. The existing device cannot be part of a
807 .No raidz
808 configuration. If
809 .Ar device
810 is not currently part of a mirrored configuration,
811 .Ar device
812 automatically transforms into a two-way mirror of
813 .Ar device No and Ar new_device .
814 If
815 .Ar device
816 is part of a two-way mirror, attaching
817 .Ar new_device
818 creates a three-way mirror, and so on. In either case,
819 .Ar new_device
820 begins to resilver immediately.
821 .Bl -tag -width indent
822 .It Fl f
823 Forces use of
824 .Ar new_device ,
825 even if its appears to be in use. Not all devices can be overridden in this
826 manner.
827 .El
828 .It Xo
829 .Nm
830 .Cm clear
831 .Op Fl F Op Fl n
832 .Ar pool
833 .Op Ar device
834 .Xc
835 .Pp
836 Clears device errors in a pool. If no arguments are specified, all device
837 errors within the pool are cleared. If one or more devices is specified, only
838 those errors associated with the specified device or devices are cleared.
839 .Bl -tag -width indent
840 .It Fl F
841 Initiates recovery mode for an unopenable pool. Attempts to discard the last
842 few transactions in the pool to return it to an openable state. Not all damaged
843 pools can be recovered by using this option. If successful, the data from the
844 discarded transactions is irretrievably lost.
845 .It Fl n
846 Used in combination with the
847 .Fl F
848 flag. Check whether discarding transactions would make the pool openable, but
849 do not actually discard any transactions.
850 .El
851 .It Xo
852 .Nm
853 .Cm create
854 .Op Fl fnd
855 .Op Fl o Ar property Ns = Ns Ar value
856 .Ar ...
857 .Op Fl O Ar file-system-property Ns = Ns Ar value
858 .Ar ...
859 .Op Fl m Ar mountpoint
860 .Op Fl R Ar root
861 .Ar pool vdev ...
862 .Xc
863 .Pp
864 Creates a new storage pool containing the virtual devices specified on the
865 command line. The pool name must begin with a letter, and can only contain
866 alphanumeric characters as well as underscore ("_"), dash ("-"), and period
867 ("."). The pool names "mirror", "raidz", "spare" and "log" are reserved, as are
868 names beginning with the pattern "c[0-9]". The
869 .No vdev
870 specification is described in the
871 .Qq Sx Virtual Devices
872 section.
873 .Pp
874 The command verifies that each device specified is accessible and not currently
875 in use by another subsystem. There are some uses, such as being currently
876 mounted, or specified as the dedicated dump device, that prevents a device from
877 ever being used by
878 .Tn ZFS
879 Other uses, such as having a preexisting
880 .Sy UFS
881 file system, can be overridden with the
882 .Fl f
883 option.
884 .Pp
885 The command also checks that the replication strategy for the pool is
886 consistent. An attempt to combine redundant and non-redundant storage in a
887 single pool, or to mix disks and files, results in an error unless
888 .Fl f
889 is specified. The use of differently sized devices within a single
890 .No raidz
891 or mirror group is also flagged as an error unless
892 .Fl f
893 is specified.
894 .Pp
895 Unless the
896 .Fl R
897 option is specified, the default mount point is
898 .Qq Pa /pool .
899 The mount point must not exist or must be empty, or else the
900 root dataset cannot be mounted. This can be overridden with the
901 .Fl m
902 option.
903 .Pp
904 By default all supported features are enabled on the new pool unless the
905 .Fl d
906 option is specified.
907 .Bl -tag -width indent
908 .It Fl f
909 Forces use of
910 .Ar vdev Ns s,
911 even if they appear in use or specify a conflicting replication level.
912 Not all devices can be overridden in this manner.
913 .It Fl n
914 Displays the configuration that would be used without actually creating the
915 pool. The actual pool creation can still fail due to insufficient privileges or
916 device sharing.
917 .It Fl d
918 Do not enable any features on the new pool.
919 Individual features can be enabled by setting their corresponding properties
920 to
921 .Sy enabled
922 with the
923 .Fl o
924 option.
925 See
926 .Xr zpool-features 7
927 for details about feature properties.
928 .It Xo
929 .Fl o Ar property Ns = Ns Ar value
930 .Op Fl o Ar property Ns = Ns Ar value
931 .Ar ...
932 .Xc
933 Sets the given pool properties. See the
934 .Qq Sx Properties
935 section for a list of valid properties that can be set.
936 .It Xo
937 .Fl O
938 .Ar file-system-property Ns = Ns Ar value
939 .Op Fl O Ar file-system-property Ns = Ns Ar value
940 .Ar ...
941 .Xc
942 Sets the given file system properties in the root file system of the pool. See
943 .Xr zfs 8 Properties
944 for a list of valid properties that
945 can be set.
946 .It Fl R Ar root
947 Equivalent to
948 .Qq Fl o Cm cachefile=none,altroot= Ns Pa root
949 .It Fl m Ar mountpoint
950 Sets the mount point for the root dataset. The default mount point is
951 .Qq Pa /pool
952 or
953 .Qq Cm altroot Ns Pa /pool
954 if
955 .Sy altroot
956 is specified. The mount point must be an absolute path,
957 .Qq Cm legacy ,
958 or
959 .Qq Cm none .
960 For more information on dataset mount points, see
961 .Xr zfs 8 .
962 .El
963 .It Xo
964 .Nm
965 .Cm destroy
966 .Op Fl f
967 .Ar pool
968 .Xc
969 .Pp
970 Destroys the given pool, freeing up any devices for other use. This command
971 tries to unmount any active datasets before destroying the pool.
972 .Bl -tag -width indent
973 .It Fl f
974 Forces any active datasets contained within the pool to be unmounted.
975 .El
976 .It Xo
977 .Nm
978 .Cm detach
979 .Ar pool device
980 .Xc
981 .Pp
982 Detaches
983 .Ar device
984 from a mirror. The operation is refused if there are no other valid replicas
985 of the data.
986 .It Xo
987 .Nm
988 .Cm export
989 .Op Fl f
990 .Ar pool ...
991 .Xc
992 .Pp
993 Exports the given pools from the system. All devices are marked as exported,
994 but are still considered in use by other subsystems. The devices can be moved
995 between systems (even those of different endianness) and imported as long as a
996 sufficient number of devices are present.
997 .Pp
998 Before exporting the pool, all datasets within the pool are unmounted. A pool
999 can not be exported if it has a shared spare that is currently being used.
1000 .Pp
1001 For pools to be portable, you must give the
1002 .Nm
1003 command whole disks, not just slices, so that
1004 .Tn ZFS
1005 can label the disks with portable
1006 .Sy EFI
1007 labels. Otherwise, disk drivers on platforms of different endianness will not
1008 recognize the disks.
1009 .Bl -tag -width indent
1010 .It Fl f
1011 Forcefully unmount all datasets, using the
1012 .Qq Nm unmount Fl f
1013 command.
1014 .Pp
1015 This command will forcefully export the pool even if it has a shared spare that
1016 is currently being used. This may lead to potential data corruption.
1017 .El
1018 .It Xo
1019 .Nm
1020 .Cm get
1021 .Ar all | property Ns Op , Ns Ar ...
1022 .Ar pool ...
1023 .Xc
1024 .Pp
1025 Retrieves the given list of properties (or all properties if
1026 .Qq Cm all
1027 is used) for the specified storage pool(s). These properties are displayed with
1028 the following fields:
1029 .Bl -column -offset indent "property"
1030 .It name Ta Name of storage pool
1031 .It property Ta Property name
1032 .It value Ta Property value
1033 .It source Ta Property source, either 'default' or 'local'.
1034 .El
1035 .Pp
1036 See the
1037 .Qq Sx Properties
1038 section for more information on the available pool properties.
1039 .It Xo
1040 .Nm
1041 .Cm history
1042 .Op Fl il
1043 .Op Ar pool
1044 .Ar ...
1045 .Xc
1046 .Pp
1047 Displays the command history of the specified pools or all pools if no pool is
1048 specified.
1049 .Bl -tag -width indent
1050 .It Fl i
1051 Displays internally logged
1052 .Tn ZFS
1053 events in addition to user initiated events.
1054 .It Fl l
1055 Displays log records in long format, which in addition to standard format
1056 includes, the user name, the hostname, and the zone in which the operation was
1057 performed.
1058 .El
1059 .It Xo
1060 .Nm
1061 .Cm import
1062 .Op Fl d Ar dir | Fl c Ar cachefile
1063 .Op Fl D
1064 .Xc
1065 .Pp
1066 Lists pools available to import. If the
1067 .Fl d
1068 option is not specified, this command searches for devices in
1069 .Qq Pa /dev .
1070 The
1071 .Fl d
1072 option can be specified multiple times, and all directories are searched. If
1073 the device appears to be part of an exported pool, this command displays a
1074 summary of the pool with the name of the pool, a numeric identifier, as well as
1075 the
1076 .No vdev
1077 layout and current health of the device for each device or file.
1078 Destroyed pools, pools that were previously destroyed with the
1079 .Qq Nm Cm destroy
1080 command, are not listed unless the
1081 .Fl D
1082 option is specified.
1083 .Pp
1084 The numeric identifier is unique, and can be used instead of the pool name when
1085 multiple exported pools of the same name are available.
1086 .Bl -tag -width indent
1087 .It Fl c Ar cachefile
1088 Reads configuration from the given
1089 .Ar cachefile
1090 that was created with the
1091 .Qq Sy cachefile
1092 pool property. This
1093 .Ar cachefile
1094 is used instead of searching for devices.
1095 .It Fl d Ar dir
1096 Searches for devices or files in
1097 .Ar dir .
1098 The
1099 .Fl d
1100 option can be specified multiple times.
1101 .It Fl D
1102 Lists destroyed pools only.
1103 .El
1104 .It Xo
1105 .Nm
1106 .Cm import
1107 .Op Fl o Ar mntopts
1108 .Op Fl o Ar property Ns = Ns Ar value
1109 .Ar ...
1110 .Op Fl d Ar dir | Fl c Ar cachefile
1111 .Op Fl D
1112 .Op Fl f
1113 .Op Fl m
1114 .Op Fl N
1115 .Op Fl R Ar root
1116 .Op Fl F Op Fl n
1117 .Fl a
1118 .Xc
1119 .Pp
1120 Imports all pools found in the search directories. Identical to the previous
1121 command, except that all pools with a sufficient number of devices available
1122 are imported. Destroyed pools, pools that were previously destroyed with the
1123 .Qq Nm Cm destroy
1124 command, will not be imported unless the
1125 .Fl D
1126 option is specified.
1127 .Bl -tag -width indent
1128 .It Fl o Ar mntopts
1129 Comma-separated list of mount options to use when mounting datasets within the
1130 pool. See
1131 .Xr zfs 8
1132 for a description of dataset properties and mount options.
1133 .It Fl o Ar property Ns = Ns Ar value
1134 Sets the specified property on the imported pool. See the
1135 .Qq Sx Properties
1136 section for more information on the available pool properties.
1137 .It Fl c Ar cachefile
1138 Reads configuration from the given
1139 .Ar cachefile
1140 that was created with the
1141 .Qq Sy cachefile
1142 pool property. This
1143 .Ar cachefile
1144 is used instead of searching for devices.
1145 .It Fl d Ar dir
1146 Searches for devices or files in
1147 .Ar dir .
1148 The
1149 .Fl d
1150 option can be specified multiple times. This option is incompatible with the
1151 .Fl c
1152 option.
1153 .It Fl D
1154 Imports destroyed pools only. The
1155 .Fl f
1156 option is also required.
1157 .It Fl f
1158 Forces import, even if the pool appears to be potentially active.
1159 .It Fl m
1160 Allows a pool to import when there is a missing log device. Recent transactions
1161 can be lost because the log device will be discarded.
1162 .It Fl N
1163 Import the pool without mounting any file systems.
1164 .It Fl R Ar root
1165 Sets the
1166 .Qq Sy cachefile
1167 property to
1168 .Qq Cm none
1169 and the
1170 .Qq Sy altroot
1171 property to
1172 .Qq Ar root
1173 .It Fl F
1174 Recovery mode for a non-importable pool. Attempt to return the pool to an
1175 importable state by discarding the last few transactions. Not all damaged pools
1176 can be recovered by using this option. If successful, the data from the
1177 discarded transactions is irretrievably lost. This option is ignored if the
1178 pool is importable or already imported.
1179 .It Fl n
1180 Used with the
1181 .Fl F
1182 recovery option. Determines whether a non-importable pool can be made
1183 importable again, but does not actually perform the pool recovery. For more
1184 details about pool recovery mode, see the
1185 .Fl F
1186 option, above.
1187 .It Fl a
1188 Searches for and imports all pools found.
1189 .El
1190 .It Xo
1191 .Nm
1192 .Cm import
1193 .Op Fl o Ar mntopts
1194 .Op Fl o Ar property Ns = Ns Ar value
1195 .Ar ...
1196 .Op Fl d Ar dir | Fl c Ar cachefile
1197 .Op Fl D
1198 .Op Fl f
1199 .Op Fl m
1200 .Op Fl N
1201 .Op Fl R Ar root
1202 .Op Fl F Op Fl n
1203 .Ar pool | id
1204 .Op Ar newpool
1205 .Xc
1206 .Pp
1207 Imports a specific pool. A pool can be identified by its name or the numeric
1208 identifier. If
1209 .Ar newpool
1210 is specified, the pool is imported using the name
1211 .Ar newpool .
1212 Otherwise, it is imported with the same name as its exported name.
1213 .Pp
1214 If a device is removed from a system without running
1215 .Qq Nm Cm export
1216 first, the device appears as potentially active. It cannot be determined if
1217 this was a failed export, or whether the device is really in use from another
1218 host. To import a pool in this state, the
1219 .Fl f
1220 option is required.
1221 .Bl -tag -width indent
1222 .It Fl o Ar mntopts
1223 Comma-separated list of mount options to use when mounting datasets within the
1224 pool. See
1225 .Xr zfs 8
1226 for a description of dataset properties and mount options.
1227 .It Fl o Ar property Ns = Ns Ar value
1228 Sets the specified property on the imported pool. See the
1229 .Qq Sx Properties
1230 section for more information on the available pool properties.
1231 .It Fl c Ar cachefile
1232 Reads configuration from the given
1233 .Ar cachefile
1234 that was created with the
1235 .Qq Sy cachefile
1236 pool property. This
1237 .Ar cachefile
1238 is used instead of searching for devices.
1239 .It Fl d Ar dir
1240 Searches for devices or files in
1241 .Ar dir .
1242 The
1243 .Fl d
1244 option can be specified multiple times. This option is incompatible with the
1245 .Fl c
1246 option.
1247 .It Fl D
1248 Imports destroyed pools only. The
1249 .Fl f
1250 option is also required.
1251 .It Fl f
1252 Forces import, even if the pool appears to be potentially active.
1253 .It Fl m
1254 Allows a pool to import when there is a missing log device. Recent transactions
1255 can be lost because the log device will be discarded.
1256 .It Fl N
1257 Import the pool without mounting any file systems.
1258 .It Fl R Ar root
1259 Equivalent to
1260 .Qq Fl o Cm cachefile=none,altroot= Ns Pa root
1261 .It Fl F
1262 Recovery mode for a non-importable pool. Attempt to return the pool to an
1263 importable state by discarding the last few transactions. Not all damaged pools
1264 can be recovered by using this option. If successful, the data from the
1265 discarded transactions is irretrievably lost. This option is ignored if the
1266 pool is importable or already imported.
1267 .It Fl n
1268 Used with the
1269 .Fl F
1270 recovery option. Determines whether a non-importable pool can be made
1271 importable again, but does not actually perform the pool recovery. For more
1272 details about pool recovery mode, see the
1273 .Fl F
1274 option, above.
1275 .El
1276 .It Xo
1277 .Nm
1278 .Cm iostat
1279 .Op Fl T Cm d Ns | Ns Cm u
1280 .Op Fl v
1281 .Op Ar pool
1282 .Ar ...
1283 .Op Ar interval Op Ar count
1284 .Xc
1285 .Pp
1286 Displays
1287 .Tn I/O
1288 statistics for the given pools. When given an interval, the statistics are
1289 printed every
1290 .Ar interval
1291 seconds until
1292 .Sy Ctrl-C
1293 is pressed. If no
1294 .Ar pools
1295 are specified, statistics for every pool in the system is shown. If
1296 .Ar count
1297 is specified, the command exits after
1298 .Ar count
1299 reports are printed.
1300 .Bl -tag -width indent
1301 .It Fl T Cm d Ns | Ns Cm u
1302 Print a timestamp.
1303 .Pp
1304 Use modifier
1305 .Cm d
1306 for standard date format. See
1307 .Xr date 1 .
1308 Use modifier
1309 .Cm u
1310 for unixtime
1311 .Pq equals Qq Ic date +%s .
1312 .It Fl v
1313 Verbose statistics. Reports usage statistics for individual
1314 .No vdev Ns s
1315 within the pool, in addition to the pool-wide statistics.
1316 .El
1317 .It Xo
1318 .Nm
1319 .Cm labelclear
1320 .Op Fl f
1321 .Ar device
1322 .Xc
1323 .Pp
1324 Removes
1325 .Tn ZFS
1326 label information from the specified
1327 .Ar device .
1328 The
1329 .Ar device
1330 must not be part of an active pool configuration.
1331 .Bl -tag -width indent
1332 .It Fl v
1333 Treat exported or foreign devices as inactive.
1334 .El
1335 .It Xo
1336 .Nm
1337 .Cm list
1338 .Op Fl Hv
1339 .Op Fl o Ar property Ns Op , Ns Ar ...
1340 .Op Fl T Cm d Ns | Ns Cm u
1341 .Op Ar pool
1342 .Ar ...
1343 .Op Ar inverval Op Ar count
1344 .Xc
1345 .Pp
1346 Lists the given pools along with a health status and space usage. If no
1347 .Ar pools
1348 are specified, all pools in the system are listed.
1349 .Pp
1350 When given an interval, the output is printed every
1351 .Ar interval
1352 seconds until
1353 .Sy Ctrl-C
1354 is pressed. If
1355 .Ar count
1356 is specified, the command exits after
1357 .Ar count
1358 reports are printed.
1359 .Bl -tag -width indent
1360 .It Fl T Cm d Ns | Ns Cm u
1361 Print a timestamp.
1362 .Pp
1363 Use modifier
1364 .Cm d
1365 for standard date format. See
1366 .Xr date 1 .
1367 Use modifier
1368 .Cm u
1369 for unixtime
1370 .Pq equals Qq Ic date +%s .
1371 .It Fl H
1372 Scripted mode. Do not display headers, and separate fields by a single tab
1373 instead of arbitrary space.
1374 .It Fl v
1375 Show more detailed information.
1376 .It Fl o Ar property Ns Op , Ns Ar ...
1377 Comma-separated list of properties to display. See the
1378 .Qq Sx Properties
1379 section for a list of valid properties. The default list is
1380 .Sy name ,
1381 .Sy size ,
1382 .Sy used ,
1383 .Sy available ,
1384 .Sy capacity  ,
1385 .Sy health ,
1386 .Sy altroot .
1387 .It Fl T Cm d Ns | Ns Cm u
1388 Print a timestamp.
1389 .Pp
1390 Use modifier
1391 .Cm d
1392 for standard date format. See
1393 .Xr date 1 .
1394 Use modifier
1395 .Cm u
1396 for unixtime
1397 .Pq equals Qq Ic date +%s .
1398 .El
1399 .It Xo
1400 .Nm
1401 .Cm offline
1402 .Op Fl t
1403 .Ar pool device ...
1404 .Xc
1405 .Pp
1406 Takes the specified physical device offline. While the
1407 .Ar device
1408 is offline, no attempt is made to read or write to the device.
1409 .Bl -tag -width indent
1410 .It Fl t
1411 Temporary. Upon reboot, the specified physical device reverts to its previous
1412 state.
1413 .El
1414 .It Xo
1415 .Nm
1416 .Cm online
1417 .Op Fl e
1418 .Ar pool device ...
1419 .Xc
1420 .Pp
1421 Brings the specified physical device online.
1422 .Pp
1423 This command is not applicable to spares or cache devices.
1424 .Bl -tag -width indent
1425 .It Fl e
1426 Expand the device to use all available space. If the device is part of a mirror
1427 or
1428 .No raidz
1429 then all devices must be expanded before the new space will become
1430 available to the pool.
1431 .El
1432 .It Xo
1433 .Nm
1434 .Cm reguid
1435 .Ar pool
1436 .Xc
1437 .Pp
1438 Generates a new unique identifier for the pool.  You must ensure that all
1439 devices in this pool are online and healthy before performing this action.
1440 .It Xo
1441 .Nm
1442 .Cm remove
1443 .Ar pool device ...
1444 .Xc
1445 .Pp
1446 Removes the specified device from the pool. This command currently only
1447 supports removing hot spares, cache, and log devices. A mirrored log device can
1448 be removed by specifying the top-level mirror for the log. Non-log devices that
1449 are part of a mirrored configuration can be removed using the
1450 .Qq Nm Cm detach
1451 command. Non-redundant and
1452 .No raidz
1453 devices cannot be removed from a pool.
1454 .It Xo
1455 .Nm
1456 .Cm reopen
1457 .Ar pool
1458 .Xc
1459 .Pp
1460 Reopen all the vdevs associated with the pool.
1461 .It Xo
1462 .Nm
1463 .Cm replace
1464 .Op Fl f
1465 .Ar pool device
1466 .Op Ar new_device
1467 .Xc
1468 .Pp
1469 Replaces
1470 .Ar old_device
1471 with
1472 .Ar new_device .
1473 This is equivalent to attaching
1474 .Ar new_device ,
1475 waiting for it to resilver, and then detaching
1476 .Ar old_device .
1477 .Pp
1478 The size of
1479 .Ar new_device
1480 must be greater than or equal to the minimum size
1481 of all the devices in a mirror or
1482 .No raidz
1483 configuration.
1484 .Pp
1485 .Ar new_device
1486 is required if the pool is not redundant. If
1487 .Ar new_device
1488 is not specified, it defaults to
1489 .Ar old_device .
1490 This form of replacement is useful after an existing disk has failed and has
1491 been physically replaced. In this case, the new disk may have the same
1492 .Pa /dev
1493 path as the old device, even though it is actually a different disk.
1494 .Tn ZFS
1495 recognizes this.
1496 .Bl -tag -width indent
1497 .It Fl f
1498 Forces use of
1499 .Ar new_device ,
1500 even if its appears to be in use. Not all devices can be overridden in this
1501 manner.
1502 .El
1503 .It Xo
1504 .Nm
1505 .Cm scrub
1506 .Op Fl s
1507 .Ar pool ...
1508 .Xc
1509 .Pp
1510 Begins a scrub. The scrub examines all data in the specified pools to verify
1511 that it checksums correctly. For replicated (mirror or
1512 .No raidz )
1513 devices,
1514 .Tn ZFS
1515 automatically repairs any damage discovered during the scrub. The
1516 .Qq Nm Cm status
1517 command reports the progress of the scrub and summarizes the results of the
1518 scrub upon completion.
1519 .Pp
1520 Scrubbing and resilvering are very similar operations. The difference is that
1521 resilvering only examines data that
1522 .Tn ZFS
1523 knows to be out of date (for example, when attaching a new device to a mirror
1524 or replacing an existing device), whereas scrubbing examines all data to
1525 discover silent errors due to hardware faults or disk failure.
1526 .Pp
1527 Because scrubbing and resilvering are
1528 .Tn I/O Ns -intensive
1529 operations,
1530 .Tn ZFS
1531 only allows one at a time. If a scrub is already in progress, the
1532 .Qq Nm Cm scrub
1533 command returns an error. To start a new scrub, you have to stop the old scrub
1534 with the
1535 .Qq Nm Cm scrub Fl s
1536 command first. If a resilver is in progress,
1537 .Tn ZFS
1538 does not allow a scrub to be started until the resilver completes.
1539 .Bl -tag -width indent
1540 .It Fl s
1541 Stop scrubbing.
1542 .El
1543 .It Xo
1544 .Nm
1545 .Cm set
1546 .Ar property Ns = Ns Ar value pool
1547 .Xc
1548 .Pp
1549 Sets the given property on the specified pool. See the
1550 .Qq Sx Properties
1551 section for more information on what properties can be set and acceptable
1552 values.
1553 .It Xo
1554 .Nm
1555 .Cm split
1556 .Op Fl n
1557 .Op Fl R Ar altroot
1558 .Op Fl o Ar mntopts
1559 .Op Fl o Ar property Ns = Ns Ar value
1560 .Ar pool newpool
1561 .Op Ar device ...
1562 .Xc
1563 .Pp
1564 Splits off one disk from each mirrored top-level
1565 .No vdev
1566 in a pool and creates a new pool from the split-off disks. The original pool
1567 must be made up of one or more mirrors and must not be in the process of
1568 resilvering. The
1569 .Cm split
1570 subcommand chooses the last device in each mirror
1571 .No vdev
1572 unless overridden by a device specification on the command line.
1573 .Pp
1574 When using a
1575 .Ar device
1576 argument,
1577 .Cm split
1578 includes the specified device(s) in a new pool and, should any devices remain
1579 unspecified, assigns the last device in each mirror
1580 .No vdev
1581 to that pool, as it does normally. If you are uncertain about the outcome of a
1582 .Cm split
1583 command, use the
1584 .Fl n
1585 ("dry-run") option to ensure your command will have the effect you intend.
1586 .Bl -tag -width indent
1587 .It Fl R Ar altroot
1588 Automatically import the newly created pool after splitting, using the
1589 specified
1590 .Ar altroot
1591 parameter for the new pool's alternate root. See the
1592 .Sy altroot
1593 description in the
1594 .Qq Sx Properties
1595 section, above.
1596 .It Fl n
1597 Displays the configuration that would be created without actually splitting the
1598 pool. The actual pool split could still fail due to insufficient privileges or
1599 device status.
1600 .It Fl o Ar mntopts
1601 Comma-separated list of mount options to use when mounting datasets within the
1602 pool. See
1603 .Xr zfs 8
1604 for a description of dataset properties and mount options. Valid only in
1605 conjunction with the
1606 .Fl R
1607 option.
1608 .It Fl o Ar property Ns = Ns Ar value
1609 Sets the specified property on the new pool. See the
1610 .Qq Sx Properties
1611 section, above, for more information on the available pool properties.
1612 .El
1613 .It Xo
1614 .Nm
1615 .Cm status
1616 .Op Fl vx
1617 .Op Fl T Cm d Ns | Ns Cm u
1618 .Op Ar pool
1619 .Ar ...
1620 .Op Ar interval Op Ar count
1621 .Xc
1622 .Pp
1623 Displays the detailed health status for the given pools. If no
1624 .Ar pool
1625 is specified, then the status of each pool in the system is displayed. For more
1626 information on pool and device health, see the
1627 .Qq Sx Device Failure and Recovery
1628 section.
1629 .Pp
1630 When given an interval, the output is printed every
1631 .Ar interval
1632 seconds until
1633 .Sy Ctrl-C
1634 is pressed. If
1635 .Ar count
1636 is specified, the command exits after
1637 .Ar count
1638 reports are printed.
1639 .Pp
1640 If a scrub or resilver is in progress, this command reports the percentage
1641 done and the estimated time to completion. Both of these are only approximate,
1642 because the amount of data in the pool and the other workloads on the system
1643 can change.
1644 .Bl -tag -width indent
1645 .It Fl x
1646 Only display status for pools that are exhibiting errors or are otherwise
1647 unavailable.
1648 Warnings about pools not using the latest on-disk format will not be included.
1649 .It Fl v
1650 Displays verbose data error information, printing out a complete list of all
1651 data errors since the last complete pool scrub.
1652 .It Fl T Cm d Ns | Ns Cm u
1653 Print a timestamp.
1654 .Pp
1655 Use modifier
1656 .Cm d
1657 for standard date format. See
1658 .Xr date 1 .
1659 Use modifier
1660 .Cm u
1661 for unixtime
1662 .Pq equals Qq Ic date +%s .
1663 .El
1664 .It Xo
1665 .Nm
1666 .Cm upgrade
1667 .Op Fl v
1668 .Xc
1669 .Pp
1670 Displays pools which do not have all supported features enabled and pools
1671 formatted using a legacy
1672 .Tn ZFS
1673 version number.
1674 These pools can continue to be used, but some features may not be available.
1675 Use
1676 .Nm Cm upgrade Fl a
1677 to enable all features on all pools.
1678 .Bl -tag -width indent
1679 .It Fl v
1680 Displays legacy
1681 .Tn ZFS
1682 versions supported by the current software.
1683 See
1684 .Xr zpool-features 7
1685 for a description of feature flags features supported by the current software.
1686 .El
1687 .It Xo
1688 .Nm
1689 .Cm upgrade
1690 .Op Fl V Ar version
1691 .Fl a | Ar pool ...
1692 .Xc
1693 .Pp
1694 Enables all supported features on the given pool.
1695 Once this is done, the pool will no longer be accessible on systems that do
1696 not support feature flags.
1697 See
1698 .Xr zpool-features 7
1699 for details on compatibility with systems that support feature flags, but do
1700 not support all features enabled on the pool.
1701 .Bl -tag -width indent
1702 .It Fl a
1703 Enables all supported features on all pools.
1704 .It Fl V Ar version
1705 Upgrade to the specified legacy version. If the
1706 .Fl V
1707 flag is specified, no features will be enabled on the pool.
1708 This option can only be used to increase version number up to the last
1709 supported legacy version number.
1710 .El
1711 .El
1712 .Sh EXIT STATUS
1713 The following exit values are returned:
1714 .Bl -tag -offset 2n -width 2n
1715 .It 0
1716 Successful completion.
1717 .It 1
1718 An error occurred.
1719 .It 2
1720 Invalid command line options were specified.
1721 .El
1722 .Sh EXAMPLES
1723 .Bl -tag -width 0n
1724 .It Sy Example 1 No Creating a RAID-Z Storage Pool
1725 .Pp
1726 The following command creates a pool with a single
1727 .No raidz
1728 root
1729 .No vdev
1730 that consists of six disks.
1731 .Bd -literal -offset 2n
1732 .Li # Ic zpool create tank raidz da0 da1 da2 da3 da4 da5
1733 .Ed
1734 .It Sy Example 2 No Creating a Mirrored Storage Pool
1735 .Pp
1736 The following command creates a pool with two mirrors, where each mirror
1737 contains two disks.
1738 .Bd -literal -offset 2n
1739 .Li # Ic zpool create tank mirror da0 da1 mirror da2 da3
1740 .Ed
1741 .It Sy Example 3 No Creating a Tn ZFS No Storage Pool by Using Partitions
1742 .Pp
1743 The following command creates an unmirrored pool using two GPT partitions.
1744 .Bd -literal -offset 2n
1745 .Li # Ic zpool create tank da0p3 da1p3
1746 .Ed
1747 .It Sy Example 4 No Creating a Tn ZFS No Storage Pool by Using Files
1748 .Pp
1749 The following command creates an unmirrored pool using files. While not
1750 recommended, a pool based on files can be useful for experimental purposes.
1751 .Bd -literal -offset 2n
1752 .Li # Ic zpool create tank /path/to/file/a /path/to/file/b
1753 .Ed
1754 .It Sy Example 5 No Adding a Mirror to a Tn ZFS No Storage Pool
1755 .Pp
1756 The following command adds two mirrored disks to the pool
1757 .Em tank ,
1758 assuming the pool is already made up of two-way mirrors. The additional space
1759 is immediately available to any datasets within the pool.
1760 .Bd -literal -offset 2n
1761 .Li # Ic zpool add tank mirror da2 da3
1762 .Ed
1763 .It Sy Example 6 No Listing Available Tn ZFS No Storage Pools
1764 .Pp
1765 The following command lists all available pools on the system.
1766 .Bd -literal -offset 2n
1767 .Li # Ic zpool list
1768 NAME   SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
1769 pool  2.70T   473G  2.24T    17%  1.00x  ONLINE  -
1770 test  1.98G  89.5K  1.98G     0%  1.00x  ONLINE  -
1771 .Ed
1772 .It Sy Example 7 No Listing All Properties for a Pool
1773 .Pp
1774 The following command lists all the properties for a pool.
1775 .Bd -literal -offset 2n
1776 .Li # Ic zpool get all pool
1777 pool  size           2.70T       -
1778 pool  capacity       17%         -
1779 pool  altroot        -           default
1780 pool  health         ONLINE      -
1781 pool  guid           2501120270416322443  default
1782 pool  version        28          default
1783 pool  bootfs         pool/root   local
1784 pool  delegation     on          default
1785 pool  autoreplace    off         default
1786 pool  cachefile      -           default
1787 pool  failmode       wait        default
1788 pool  listsnapshots  off         default
1789 pool  autoexpand     off         default
1790 pool  dedupditto     0           default
1791 pool  dedupratio     1.00x       -
1792 pool  free           2.24T       -
1793 pool  allocated      473G        -
1794 pool  readonly       off         -
1795 .Ed
1796 .It Sy Example 8 No Destroying a Tn ZFS No Storage Pool
1797 .Pp
1798 The following command destroys the pool
1799 .Qq Em tank
1800 and any datasets contained within.
1801 .Bd -literal -offset 2n
1802 .Li # Ic zpool destroy -f tank
1803 .Ed
1804 .It Sy Example 9 No Exporting a Tn ZFS No Storage Pool
1805 .Pp
1806 The following command exports the devices in pool
1807 .Em tank
1808 so that they can be relocated or later imported.
1809 .Bd -literal -offset 2n
1810 .Li # Ic zpool export tank
1811 .Ed
1812 .It Sy Example 10 No Importing a Tn ZFS No Storage Pool
1813 .Pp
1814 The following command displays available pools, and then imports the pool
1815 .Qq Em tank
1816 for use on the system.
1817 .Pp
1818 The results from this command are similar to the following:
1819 .Bd -literal -offset 2n
1820 .Li # Ic zpool import
1821
1822   pool: tank
1823     id: 15451357997522795478
1824  state: ONLINE
1825 action: The pool can be imported using its name or numeric identifier.
1826 config:
1827
1828         tank        ONLINE
1829           mirror    ONLINE
1830                da0  ONLINE
1831                da1  ONLINE
1832 .Ed
1833 .It Xo
1834 .Sy Example 11
1835 Upgrading All
1836 .Tn ZFS
1837 Storage Pools to the Current Version
1838 .Xc
1839 .Pp
1840 The following command upgrades all
1841 .Tn ZFS
1842 Storage pools to the current version of
1843 the software.
1844 .Bd -literal -offset 2n
1845 .Li # Ic zpool upgrade -a
1846 This system is currently running ZFS pool version 28.
1847 .Ed
1848 .It Sy Example 12 No Managing Hot Spares
1849 .Pp
1850 The following command creates a new pool with an available hot spare:
1851 .Bd -literal -offset 2n
1852 .Li # Ic zpool create tank mirror da0 da1 spare da2
1853 .Ed
1854 .Pp
1855 If one of the disks were to fail, the pool would be reduced to the degraded
1856 state. The failed device can be replaced using the following command:
1857 .Bd -literal -offset 2n
1858 .Li # Ic zpool replace tank da0 da2
1859 .Ed
1860 .Pp
1861 Once the data has been resilvered, the spare is automatically removed and is
1862 made available should another device fails. The hot spare can be permanently
1863 removed from the pool using the following command:
1864 .Bd -literal -offset 2n
1865 .Li # Ic zpool remove tank da2
1866 .Ed
1867 .It Xo
1868 .Sy Example 13
1869 Creating a
1870 .Tn ZFS
1871 Pool with Mirrored Separate Intent Logs
1872 .Xc
1873 .Pp
1874 The following command creates a
1875 .Tn ZFS
1876 storage pool consisting of two, two-way
1877 mirrors and mirrored log devices:
1878 .Bd -literal -offset 2n
1879 .Li # Ic zpool create pool mirror da0 da1 mirror da2 da3 log mirror da4 da5
1880 .Ed
1881 .It Sy Example 14 No Adding Cache Devices to a Tn ZFS No Pool
1882 .Pp
1883 The following command adds two disks for use as cache devices to a
1884 .Tn ZFS
1885 storage pool:
1886 .Bd -literal -offset 2n
1887 .Li # Ic zpool add pool cache da2 da3
1888 .Ed
1889 .Pp
1890 Once added, the cache devices gradually fill with content from main memory.
1891 Depending on the size of your cache devices, it could take over an hour for
1892 them to fill. Capacity and reads can be monitored using the
1893 .Cm iostat
1894 subcommand as follows:
1895 .Bd -literal -offset 2n
1896 .Li # Ic zpool iostat -v pool 5
1897 .Ed
1898 .It Sy Example 15 No Removing a Mirrored Log Device
1899 .Pp
1900 The following command removes the mirrored log device
1901 .Em mirror-2 .
1902 .Pp
1903 Given this configuration:
1904 .Bd -literal -offset 2n
1905    pool: tank
1906   state: ONLINE
1907   scrub: none requested
1908  config:
1909
1910          NAME        STATE     READ WRITE CKSUM
1911          tank        ONLINE       0     0     0
1912            mirror-0  ONLINE       0     0     0
1913                 da0  ONLINE       0     0     0
1914                 da1  ONLINE       0     0     0
1915            mirror-1  ONLINE       0     0     0
1916                 da2  ONLINE       0     0     0
1917                 da3  ONLINE       0     0     0
1918          logs
1919            mirror-2  ONLINE       0     0     0
1920                 da4  ONLINE       0     0     0
1921                 da5  ONLINE       0     0     0
1922 .Ed
1923 .Pp
1924 The command to remove the mirrored log
1925 .Em mirror-2
1926 is:
1927 .Bd -literal -offset 2n
1928 .Li # Ic zpool remove tank mirror-2
1929 .Ed
1930 .It Sy Example 16 No Recovering a Faulted Tn ZFS No Pool
1931 .Pp
1932 If a pool is faulted but recoverable, a message indicating this state is
1933 provided by
1934 .Qq Nm Cm status
1935 if the pool was cached (see the
1936 .Fl c Ar cachefile
1937 argument above), or as part of the error output from a failed
1938 .Qq Nm Cm import
1939 of the pool.
1940 .Pp
1941 Recover a cached pool with the
1942 .Qq Nm Cm clear
1943 command:
1944 .Bd -literal -offset 2n
1945 .Li # Ic zpool clear -F data
1946 Pool data returned to its state as of Tue Sep 08 13:23:35 2009.
1947 Discarded approximately 29 seconds of transactions.
1948 .Ed
1949 .Pp
1950 If the pool configuration was not cached, use
1951 .Qq Nm Cm import
1952 with the recovery mode flag:
1953 .Bd -literal -offset 2n
1954 .Li # Ic zpool import -F data
1955 Pool data returned to its state as of Tue Sep 08 13:23:35 2009.
1956 Discarded approximately 29 seconds of transactions.
1957 .Ed
1958 .El
1959 .Sh SEE ALSO
1960 .Xr zpool-features 7 ,
1961 .Xr zfs 8
1962 .Sh AUTHORS
1963 This manual page is a
1964 .Xr mdoc 7
1965 reimplementation of the
1966 .Tn OpenSolaris
1967 manual page
1968 .Em zpool(1M) ,
1969 modified and customized for
1970 .Fx
1971 and licensed under the Common Development and Distribution License
1972 .Pq Tn CDDL .
1973 .Pp
1974 The
1975 .Xr mdoc 7
1976 implementation of this manual page was initially written by
1977 .An Martin Matuska Aq mm@FreeBSD.org .
1978 .Sh CAVEATS
1979 The
1980 .Cm spare
1981 feature requires a utility to detect zpool degradation and initiate
1982 disk replacement within the zpool. FreeBSD does not provide such a
1983 utility at this time.