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