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