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