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