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