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