]> CyberLeo.Net >> Repos - FreeBSD/releng/7.2.git/blob - cddl/contrib/opensolaris/cmd/zpool/zpool.8
Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.
[FreeBSD/releng/7.2.git] / cddl / contrib / opensolaris / cmd / zpool / zpool.8
1 '\" te
2 .\" CDDL HEADER START
3 .\"
4 .\" The contents of this file are subject to the terms of the
5 .\" Common Development and Distribution License (the "License").  
6 .\" You may not use this file except in compliance with the License.
7 .\"
8 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 .\" or http://www.opensolaris.org/os/licensing.
10 .\" See the License for the specific language governing permissions
11 .\" and limitations under the License.
12 .\"
13 .\" When distributing Covered Code, include this CDDL HEADER in each
14 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 .\" If applicable, add the following below this CDDL HEADER, with the
16 .\" fields enclosed by brackets "[]" replaced with your own identifying
17 .\" information: Portions Copyright [yyyy] [name of copyright owner]
18 .\"
19 .\" CDDL HEADER END
20 .\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved.
21 .TH zpool 1M "14 Nov 2006" "SunOS 5.11" "System Administration Commands"
22 .SH NAME
23 zpool \- configures ZFS storage pools
24 .SH SYNOPSIS
25 .LP
26 .nf
27 \fBzpool\fR [\fB-?\fR]
28 .fi
29
30 .LP
31 .nf
32 \fBzpool create\fR [\fB-fn\fR] [\fB-R\fR \fIroot\fR] [\fB-m\fR \fImountpoint\fR] \fIpool\fR \fIvdev ...\fR
33 .fi
34
35 .LP
36 .nf
37 \fBzpool destroy\fR [\fB-f\fR] \fIpool\fR
38 .fi
39
40 .LP
41 .nf
42 \fBzpool add\fR [\fB-fn\fR] \fIpool\fR \fIvdev\fR
43 .fi
44
45 .LP
46 .nf
47 \fBzpool remove\fR \fIpool\fR \fIvdev\fR
48 .fi
49
50 .LP
51 .nf
52 \fBzpool \fR \fBlist\fR [\fB-H\fR] [\fB-o\fR \fIfield\fR[,\fIfield\fR]*] [\fIpool\fR] ...
53 .fi
54
55 .LP
56 .nf
57 \fBzpool iostat\fR [\fB-v\fR] [\fIpool\fR] ... [\fIinterval\fR [\fIcount\fR]]
58 .fi
59
60 .LP
61 .nf
62 \fBzpool status\fR [\fB-xv\fR] [\fIpool\fR] ...
63 .fi
64
65 .LP
66 .nf
67 \fBzpool offline\fR [\fB-t\fR] \fIpool\fR \fIdevice\fR ...
68 .fi
69
70 .LP
71 .nf
72 \fBzpool online\fR \fIpool\fR \fIdevice\fR ...
73 .fi
74
75 .LP
76 .nf
77 \fBzpool clear\fR \fIpool\fR [\fIdevice\fR] ...
78 .fi
79
80 .LP
81 .nf
82 \fBzpool attach\fR [\fB-f\fR] \fIpool\fR \fIdevice\fR \fInew_device\fR
83 .fi
84
85 .LP
86 .nf
87 \fBzpool detach\fR \fIpool\fR \fIdevice\fR
88 .fi
89
90 .LP
91 .nf
92 \fBzpool replace\fR [\fB-f\fR] \fIpool\fR \fIdevice\fR [\fInew_device\fR]
93 .fi
94
95 .LP
96 .nf
97 \fBzpool scrub\fR [\fB-s\fR] \fIpool\fR ...
98 .fi
99
100 .LP
101 .nf
102 \fBzpool export\fR [\fB-f\fR] \fIpool\fR
103 .fi
104
105 .LP
106 .nf
107 \fBzpool import\fR [\fB-d\fR \fIdir\fR] [\fB-D\fR]
108 .fi
109
110 .LP
111 .nf
112 \fBzpool import\fR [\fB-d\fR \fIdir\fR] [\fB-D\fR] [\fB-f\fR] [\fB-o \fIopts\fR\fR] [\fB-R \fR\fIroot\fR] \fIpool\fR | \fIid\fR 
113     [\fInewpool\fR]
114 .fi
115
116 .LP
117 .nf
118 \fBzpool import\fR [\fB-d\fR \fIdir\fR] [\fB-D\fR] [\fB-f\fR] [\fB-a\fR]
119 .fi
120
121 .LP
122 .nf
123 \fBzpool upgrade\fR 
124 .fi
125
126 .LP
127 .nf
128 \fBzpool upgrade\fR \fB-v\fR
129 .fi
130
131 .LP
132 .nf
133 \fBzpool upgrade\fR [\fB-a\fR | \fIpool\fR]
134 .fi
135
136 .LP
137 .nf
138 \fBzpool history\fR [\fIpool\fR] ...
139 .fi
140
141 .SH DESCRIPTION
142 .LP
143 The \fBzpool\fR command configures \fBZFS\fR storage pools. A storage pool is a collection of devices that provides physical storage and data replication for \fBZFS\fR datasets.
144 .LP
145 All datasets within a storage pool share the same space. See \fBzfs\fR(1M) for information on managing datasets. 
146 .SS "Virtual Devices (vdevs)"
147 .LP
148 A "virtual device" describes a single device or a collection of devices organized according to certain performance and fault characteristics. The following virtual devices are supported:
149 .sp
150 .ne 2
151 .mk
152 .na
153 \fBdisk\fR
154 .ad
155 .RS 10n
156 .rt  
157 A block device, typically located under "/dev/dsk". \fBZFS\fR can use individual slices or partitions, though the recommended mode of operation is to use whole disks. A disk can be specified by a full path, or it can be a shorthand name (the relative portion
158 of the path under "/dev/dsk"). A whole disk can be specified by omitting the slice or partition designation. For example, "c0t0d0" is equivalent to "/dev/dsk/c0t0d0s2". When given a whole disk, \fBZFS\fR automatically labels the disk, if necessary.
159 .RE
160
161 .sp
162 .ne 2
163 .mk
164 .na
165 \fBfile\fR
166 .ad
167 .RS 10n
168 .rt  
169 A regular file. The use of files as a backing store is strongly discouraged. It is designed primarily for experimental purposes, as the fault tolerance of a file is only as good as the file system of which it is a part. A file must be specified by a full path.
170 .RE
171
172 .sp
173 .ne 2
174 .mk
175 .na
176 \fBmirror\fR
177 .ad
178 .RS 10n
179 .rt  
180 A mirror of two or more devices. Data is replicated in an identical fashion across all components of a mirror. A mirror with \fIN\fR disks of size \fIX\fR can hold \fIX\fR bytes and can withstand (\fIN-1\fR)
181 devices failing before data integrity is compromised.
182 .RE
183
184 .sp
185 .ne 2
186 .mk
187 .na
188 \fBraidz\fR
189 .ad
190 .br
191 .na
192 \fBraidz1\fR
193 .ad
194 .br
195 .na
196 \fBraidz2\fR
197 .ad
198 .RS 10n
199 .rt  
200 A variation on \fBRAID-5\fR that allows for better distribution of parity and eliminates the "\fBRAID-5\fR write hole" (in which data and parity become inconsistent after a power loss). Data and parity is striped across all disks within a \fBraidz\fR group.
201 .sp
202 A \fBraidz\fR group can have either single- or double-parity, meaning that the \fBraidz\fR group can sustain one or two failures respectively without losing any data. The \fBraidz1\fR \fBvdev\fR type specifies a single-parity \fBraidz\fR group
203 and the \fBraidz2\fR \fBvdev\fR type specifies a double-parity \fBraidz\fR group. The \fBraidz\fR \fBvdev\fR type is an alias for \fBraidz1\fR.
204 .sp
205 A \fBraidz\fR group with \fIN\fR disks of size \fIX\fR with \fIP\fR parity disks can hold approximately (\fIN-P\fR)*\fIX\fR bytes and can withstand one device failing before
206 data integrity is compromised. The minimum number of devices in a \fBraidz\fR group is one more than the number of parity disks. The recommended number is between 3 and 9.
207 .RE
208
209 .sp
210 .ne 2
211 .mk
212 .na
213 \fBspare\fR
214 .ad
215 .RS 10n
216 .rt  
217 A special pseudo-\fBvdev\fR which keeps track of available hot spares for a pool. For more information, see the "Hot Spares" section.
218 .RE
219
220 .LP
221 Virtual devices cannot be nested, so a mirror or \fBraidz\fR virtual device can only contain files or disks. Mirrors of mirrors (or other combinations) are not allowed.
222 .LP
223 A pool can have any number of virtual devices at the top of the configuration (known as "root vdevs"). Data is dynamically distributed across all top-level devices to balance data among devices. As new virtual devices are added, \fBZFS\fR automatically places data
224 on the newly available devices.
225 .LP
226 Virtual devices are specified one at a time on the command line, separated by whitespace. The keywords "mirror" and "raidz" are used to distinguish where a group ends and another begins. For example, the following creates two root vdevs, each a mirror of two disks:
227 .sp
228 .in +2
229 .nf
230 \fB# zpool create mypool mirror c0t0d0 c0t1d0 mirror c1t0d0 c1t1d0\fR
231 .fi
232 .in -2
233 .sp
234
235 .SS "Device Failure and Recovery"
236 .LP
237 \fBZFS\fR supports a rich set of mechanisms for handling device failure and data corruption. All metadata and data is checksummed, and \fBZFS\fR automatically repairs bad data from a good copy when corruption is detected.
238 .LP
239 In order to take advantage of these features, a pool must make use of some form of redundancy, using either mirrored or \fBraidz\fR groups. While \fBZFS\fR supports running in a non-redundant configuration, where each root vdev is simply a disk or file, this is
240 strongly discouraged. A single case of bit corruption can render some or all of your data unavailable.
241 .LP
242 A pool's health status is described by one of three states: online, degraded, or faulted. An online pool has all devices operating normally. A degraded pool is one in which one or more devices have failed, but the data is still available due to a redundant configuration. A faulted pool has
243 one or more failed devices, and there is insufficient redundancy to replicate the missing data.
244 .SS "Hot Spares"
245 .LP
246 \fBZFS\fR allows devices to be associated with pools as "hot spares". These devices are not actively used in the pool, but when an active device fails, it is automatically replaced by a hot spare. To create a pool with hot spares, specify a "spare" \fBvdev\fR with any number of devices. For example, 
247 .sp
248 .in +2
249 .nf
250 # zpool create pool mirror c0d0 c1d0 spare c2d0 c3d0
251 .fi
252 .in -2
253 .sp
254
255 .LP
256 Spares can be shared across multiple pools, and can be added with the "zpool add" command and removed with the "zpool remove" command. Once a spare replacement is initiated, a new "spare" \fBvdev\fR is created within the configuration that
257 will remain there until the original device is replaced. At this point, the hot spare becomes available again if another device fails.
258 .LP
259 An in-progress spare replacement can be cancelled by detaching the hot spare. If the original faulted device is detached, then the hot spare assumes its place in the configuration, and is removed from the spare list of all active pools.
260 .SS "Alternate Root Pools"
261 .LP
262 The "zpool create -R" and "zpool import -R" commands allow users to create and import a pool with a different root path. By default, whenever a pool is created or imported on a system, it is permanently added so that it is available whenever the system boots. For
263 removable media, or when in recovery situations, this may not always be desirable. An alternate root pool does not persist on the system. Instead, it exists only until exported or the system is rebooted, at which point it will have to be imported again.
264 .LP
265 In addition, all mount points in the pool are prefixed with the given root, so a pool can be constrained to a particular area of the file system. This is most useful when importing unknown pools from removable media, as the mount points of any file systems cannot be trusted.
266 .LP
267 When creating an alternate root pool, the default mount point is "/", rather than the normal default "/\fIpool\fR".
268 .SS "Subcommands"
269 .LP
270 All subcommands that modify state are logged persistently to the pool in their original form.
271 .LP
272 The \fBzpool\fR command provides subcommands to create and destroy storage pools, add capacity to storage pools, and provide information about the storage pools. The following subcommands are supported:
273 .sp
274 .ne 2
275 .mk
276 .na
277 \fB\fBzpool\fR \fB-?\fR\fR
278 .ad
279 .sp .6
280 .RS 4n
281 Displays a help message.
282 .RE
283
284 .sp
285 .ne 2
286 .mk
287 .na
288 \fB\fBzpool create\fR [\fB-fn\fR] [\fB-R\fR \fIroot\fR] [\fB-m\fR \fImountpoint\fR] \fIpool\fR \fIvdev ...\fR\fR
289 .ad
290 .sp .6
291 .RS 4n
292 Creates a new storage pool containing the virtual devices specified on the command line. The pool name must begin with a letter, and can only contain alphanumeric characters as well as underscore ("_"), dash ("-"), and period ("."). The pool
293 names "mirror", "raidz", and "spare" are reserved, as are names beginning with the pattern "c[0-9]". The \fBvdev\fR specification is described in the "Virtual Devices" section.
294 .sp
295 The command verifies that each device specified is accessible and not currently in use by another subsystem. There are some uses, such as being currently mounted, or specified as the dedicated dump device, that prevents a device from ever being used by \fBZFS\fR. Other uses,
296 such as having a preexisting \fBUFS\fR file system, can be overridden with the \fB-f\fR option.
297 .sp
298 The command also checks that the replication strategy for the pool is consistent. An attempt to combine redundant and non-redundant storage in a single pool, or to mix disks and files, results in an error unless \fB-f\fR is specified. The use of differently sized devices within
299 a single \fBraidz\fR or mirror group is also flagged as an error unless \fB-f\fR is specified.
300 .sp
301 Unless the \fB-R\fR option is specified, the default mount point is "/\fIpool\fR". The mount point must not exist or must be empty, or else the root dataset cannot be mounted. This can be overridden with the \fB-m\fR option.
302 .sp
303 .ne 2
304 .mk
305 .na
306 \fB\fB-f\fR\fR
307 .ad
308 .RS 17n
309 .rt  
310 Forces use of \fBvdev\fRs, even if they appear in use or specify a conflicting replication level. Not all devices can be overridden in this manner.
311 .RE
312
313 .sp
314 .ne 2
315 .mk
316 .na
317 \fB\fB-n\fR\fR
318 .ad
319 .RS 17n
320 .rt  
321 Displays the configuration that would be used without actually creating the pool. The actual pool creation can still fail due to insufficient privileges or device sharing.
322 .RE
323
324 .sp
325 .ne 2
326 .mk
327 .na
328 \fB\fB-R\fR \fIroot\fR\fR
329 .ad
330 .RS 17n
331 .rt  
332 Creates the pool with an alternate \fIroot\fR. See the "Alternate Root Pools" section. The root dataset has its mount point set to "/" as part of this operation.
333 .RE
334
335 .sp
336 .ne 2
337 .mk
338 .na
339 \fB\fB-m\fR \fImountpoint\fR\fR
340 .ad
341 .RS 17n
342 .rt  
343 Sets the mount point for the root dataset. The default mount point is "/\fIpool\fR". The mount point must be an absolute path, "\fBlegacy\fR", or "\fBnone\fR". For more information on dataset mount
344 points, see \fBzfs\fR(1M).
345 .RE
346
347 .RE
348
349 .sp
350 .ne 2
351 .mk
352 .na
353 \fB\fBzpool destroy\fR [\fB-f\fR] \fIpool\fR\fR
354 .ad
355 .sp .6
356 .RS 4n
357 Destroys the given pool, freeing up any devices for other use. This command tries to unmount any active datasets before destroying the pool.
358 .sp
359 .ne 2
360 .mk
361 .na
362 \fB\fB-f\fR\fR
363 .ad
364 .RS 6n
365 .rt  
366 Forces any active datasets contained within the pool to be unmounted.
367 .RE
368
369 .RE
370
371 .sp
372 .ne 2
373 .mk
374 .na
375 \fB\fBzpool add\fR [\fB-fn\fR] \fIpool\fR \fIvdev ...\fR\fR
376 .ad
377 .sp .6
378 .RS 4n
379 Adds the specified virtual devices to the given pool. The \fIvdev\fR specification is described in the "Virtual Devices" section. The behavior of the \fB-f\fR option, and the device checks performed are described in the "zpool create"
380 subcommand.
381 .sp
382 .ne 2
383 .mk
384 .na
385 \fB\fB-f\fR\fR
386 .ad
387 .RS 6n
388 .rt  
389 Forces use of \fBvdev\fRs, even if they appear in use or specify a conflicting replication level. Not all devices can be overridden in this manner.
390 .RE
391
392 .sp
393 .ne 2
394 .mk
395 .na
396 \fB\fB-n\fR\fR
397 .ad
398 .RS 6n
399 .rt  
400 Displays the configuration that would be used without actually adding the \fBvdev\fRs. The actual pool creation can still fail due to insufficient privileges or device sharing.
401 .RE
402
403 Do not add a disk that is currently configured as a quorum device to a zpool. Once a disk is in a zpool, that disk can then be configured as a quorum device.
404 .RE
405
406 .sp
407 .ne 2
408 .mk
409 .na
410 \fB\fBzpool remove\fR \fIpool\fR \fIvdev\fR\fR
411 .ad
412 .sp .6
413 .RS 4n
414 Removes the given \fBvdev\fR from the pool. This command currently only supports removing hot spares. Devices which are part of a mirror can be removed using the "zpool detach" command. \fBRaidz\fR and top-level \fBvdevs\fR cannot
415 be removed from a pool.
416 .RE
417
418 .sp
419 .ne 2
420 .mk
421 .na
422 \fB\fBzpool list\fR [\fB-H\fR] [\fB-o\fR \fIfield\fR[,\fIfield*\fR]] [\fIpool\fR] ...\fR
423 .ad
424 .sp .6
425 .RS 4n
426 Lists the given pools along with a health status and space usage. When given no arguments, all pools in the system are listed.
427 .sp
428 .ne 2
429 .mk
430 .na
431 \fB\fB-H\fR\fR
432 .ad
433 .RS 12n
434 .rt  
435 Scripted mode. Do not display headers, and separate fields by a single tab instead of arbitrary space.
436 .RE
437
438 .sp
439 .ne 2
440 .mk
441 .na
442 \fB\fB-o\fR \fIfield\fR\fR
443 .ad
444 .RS 12n
445 .rt  
446 Comma-separated list of fields to display. Each field must be one of:
447 .sp
448 .in +2
449 .nf
450 name            Pool name
451 size            Total size
452 used            Amount of space used
453 available       Amount of space available
454 capacity        Percentage of pool space used
455 health          Health status
456 .fi
457 .in -2
458 .sp
459
460 The default is all fields.
461 .RE
462
463 This command reports actual physical space available to the storage pool. The physical space can be different from the total amount of space that any contained datasets can actually use. The amount of space used in a \fBraidz\fR configuration depends on the characteristics of
464 the data being written. In addition, \fBZFS\fR reserves some space for internal accounting that the \fBzfs\fR(1M) command takes into account, but the \fBzpool\fR command does not. For non-full pools of a reasonable size, these effects should be invisible. For small pools, or pools that are close to being completely full, these discrepancies may become more noticeable.
465 .RE
466
467 .sp
468 .ne 2
469 .mk
470 .na
471 \fB\fBzpool iostat\fR [\fB-v\fR] [\fIpool\fR] ... [\fIinterval\fR [\fIcount\fR]]\fR
472 .ad
473 .sp .6
474 .RS 4n
475 Displays \fBI/O\fR statistics for the given pools. When given an interval, the statistics are printed every \fIinterval\fR seconds until \fBCtrl-C\fR is pressed. If no \fIpools\fR are specified, statistics for
476 every pool in the system is shown. If \fIcount\fR is specified, the command exits after \fIcount\fR reports are printed.
477 .sp
478 .ne 2
479 .mk
480 .na
481 \fB\fB-v\fR\fR
482 .ad
483 .RS 6n
484 .rt  
485 Verbose statistics. Reports usage statistics for individual \fIvdevs\fR within the pool, in addition to the pool-wide statistics.
486 .RE
487
488 .RE
489
490 .sp
491 .ne 2
492 .mk
493 .na
494 \fB\fBzpool status\fR [\fB-xv\fR] [\fIpool\fR] ...\fR
495 .ad
496 .sp .6
497 .RS 4n
498 Displays the detailed health status for the given pools. If no \fIpool\fR is specified, then the status of each pool in the system is displayed.
499 .sp
500 If a scrub or resilver is in progress, this command reports the percentage done and the estimated time to completion. Both of these are only approximate, because the amount of data in the pool and the other workloads on the system can change.
501 .sp
502 .ne 2
503 .mk
504 .na
505 \fB\fB-x\fR\fR
506 .ad
507 .RS 6n
508 .rt  
509 Only display status for pools that are exhibiting errors or are otherwise unavailable.
510 .RE
511
512 .sp
513 .ne 2
514 .mk
515 .na
516 \fB\fB-v\fR\fR
517 .ad
518 .RS 6n
519 .rt  
520 Displays verbose data error information, printing out a complete list of all data errors since the last complete pool scrub.
521 .RE
522
523 .RE
524
525 .sp
526 .ne 2
527 .mk
528 .na
529 \fB\fBzpool offline\fR [\fB-t\fR] \fIpool\fR \fIdevice\fR ...\fR
530 .ad
531 .sp .6
532 .RS 4n
533 Takes the specified physical device offline. While the \fIdevice\fR is offline, no attempt is made to read or write to the device.
534 .sp
535 This command is not applicable to spares.
536 .sp
537 .ne 2
538 .mk
539 .na
540 \fB\fB-t\fR\fR
541 .ad
542 .RS 6n
543 .rt  
544 Temporary. Upon reboot, the specified physical device reverts to its previous state.
545 .RE
546
547 .RE
548
549 .sp
550 .ne 2
551 .mk
552 .na
553 \fB\fBzpool online\fR \fIpool\fR \fIdevice\fR ...\fR
554 .ad
555 .sp .6
556 .RS 4n
557 Brings the specified physical device online.
558 .sp
559 This command is not applicable to spares.
560 .RE
561
562 .sp
563 .ne 2
564 .mk
565 .na
566 \fB\fBzpool clear\fR \fIpool\fR [\fIdevice\fR] ...\fR
567 .ad
568 .sp .6
569 .RS 4n
570 Clears device errors in a pool. If no arguments are specified, all device errors within the pool are cleared. If one or more devices is specified, only those errors associated with the specified device or devices are cleared.
571 .RE
572
573 .sp
574 .ne 2
575 .mk
576 .na
577 \fB\fBzpool attach\fR [\fB-f\fR] \fIpool\fR \fIdevice\fR \fInew_device\fR\fR
578 .ad
579 .sp .6
580 .RS 4n
581 Attaches \fInew_device\fR to an existing \fBzpool\fR device. The existing device cannot be part of a \fBraidz\fR configuration. If \fIdevice\fR is not currently part of a mirrored configuration, \fIdevice\fR automatically
582 transforms into a two-way mirror of \fIdevice\fR and \fInew_device\fR. If \fIdevice\fR is part of a two-way mirror, attaching \fInew_device\fR creates a three-way mirror, and so on. In either case, \fInew_device\fR begins to resilver immediately.
583 .sp
584 .ne 2
585 .mk
586 .na
587 \fB\fB-f\fR\fR
588 .ad
589 .RS 6n
590 .rt  
591 Forces use of \fInew_device\fR, even if its appears to be in use. Not all devices can be overridden in this manner.
592 .RE
593
594 .RE
595
596 .sp
597 .ne 2
598 .mk
599 .na
600 \fB\fBzpool detach\fR \fIpool\fR \fIdevice\fR\fR
601 .ad
602 .sp .6
603 .RS 4n
604 Detaches \fIdevice\fR from a mirror. The operation is refused if there are no other valid replicas of the data.
605 .RE
606
607 .sp
608 .ne 2
609 .mk
610 .na
611 \fB\fBzpool replace\fR [\fB-f\fR] \fIpool\fR \fIold_device\fR [\fInew_device\fR]\fR
612 .ad
613 .sp .6
614 .RS 4n
615 Replaces \fIold_device\fR with \fInew_device\fR. This is equivalent to attaching \fInew_device\fR, waiting for it to resilver, and then detaching \fIold_device\fR.
616 .sp
617 The size of \fInew_device\fR must be greater than or equal to the minimum size of all the devices in a mirror or \fBraidz\fR configuration.
618 .sp
619 If \fInew_device\fR is not specified, it defaults to \fIold_device\fR. This form of replacement is useful after an existing disk has failed and has been physically replaced. In this case, the new disk may have the same \fB/dev/dsk\fR path
620 as the old device, even though it is actually a different disk. \fBZFS\fR recognizes this.
621 .sp
622 .ne 2
623 .mk
624 .na
625 \fB\fB-f\fR\fR
626 .ad
627 .RS 6n
628 .rt  
629 Forces use of \fInew_device\fR, even if its appears to be in use. Not all devices can be overridden in this manner.
630 .RE
631
632 .RE
633
634 .sp
635 .ne 2
636 .mk
637 .na
638 \fB\fBzpool scrub\fR [\fB-s\fR] \fIpool\fR ...\fR
639 .ad
640 .sp .6
641 .RS 4n
642 Begins a scrub. The scrub examines all data in the specified pools to verify that it checksums correctly. For replicated (mirror or \fBraidz\fR) devices, \fBZFS\fR automatically repairs any damage discovered during the scrub. The "\fBzpool
643 status\fR" command reports the progress of the scrub and summarizes the results of the scrub upon completion.
644 .sp
645 Scrubbing and resilvering are very similar operations. The difference is that resilvering only examines data that \fBZFS\fR knows to be out of date (for example, when attaching a new device to a mirror or replacing an existing device), whereas scrubbing examines all data to
646 discover silent errors due to hardware faults or disk failure.
647 .sp
648 Because scrubbing and resilvering are \fBI/O\fR-intensive operations, \fBZFS\fR only allows one at a time. If a scrub is already in progress, the "\fBzpool scrub\fR" command terminates it and starts a new scrub. If a resilver is in progress, \fBZFS\fR does not allow a scrub to be started until the resilver completes.
649 .sp
650 .ne 2
651 .mk
652 .na
653 \fB\fB-s\fR\fR
654 .ad
655 .RS 6n
656 .rt  
657 Stop scrubbing.
658 .RE
659
660 .RE
661
662 .sp
663 .ne 2
664 .mk
665 .na
666 \fB\fBzpool export\fR [\fB-f\fR] \fIpool\fR ...\fR
667 .ad
668 .sp .6
669 .RS 4n
670 Exports the given pools from the system. All devices are marked as exported, but are still considered in use by other subsystems. The devices can be moved between systems (even those of different endianness) and imported as long as a sufficient number of devices are present.
671 .sp
672 Before exporting the pool, all datasets within the pool are unmounted.
673 .sp
674 For pools to be portable, you must give the \fBzpool\fR command whole disks, not just slices, so that \fBZFS\fR can label the disks with portable \fBEFI\fR labels. Otherwise, disk drivers on platforms of different endianness will not recognize the disks.
675 .sp
676 .ne 2
677 .mk
678 .na
679 \fB\fB-f\fR\fR
680 .ad
681 .RS 6n
682 .rt  
683 Forcefully unmount all datasets, using the "\fBunmount -f\fR" command.
684 .RE
685
686 .RE
687
688 .sp
689 .ne 2
690 .mk
691 .na
692 \fB\fBzpool import\fR [\fB-d\fR \fIdir\fR] [\fB-D\fR]\fR
693 .ad
694 .sp .6
695 .RS 4n
696 Lists pools available to import. If the \fB-d\fR option is not specified, this command searches for devices in "/dev/dsk". The \fB-d\fR option can be specified multiple times, and all directories are searched. If the device appears to be part of
697 an exported pool, this command displays a summary of the pool with the name of the pool, a numeric identifier, as well as the \fIvdev\fR layout and current health of the device for each device or file. Destroyed pools, pools that were previously destroyed with the "\fB-zpool destroy\fR" command, are not listed unless the \fB-D\fR option is specified. 
698 .sp
699 The numeric identifier is unique, and can be used instead of the pool name when multiple exported pools of the same name are available.
700 .sp
701 .ne 2
702 .mk
703 .na
704 \fB\fB-d\fR \fIdir\fR\fR
705 .ad
706 .RS 10n
707 .rt  
708 Searches for devices or files in \fIdir\fR. The \fB-d\fR option can be specified multiple times.
709 .RE
710
711 .sp
712 .ne 2
713 .mk
714 .na
715 \fB\fB-D\fR\fR
716 .ad
717 .RS 10n
718 .rt  
719 Lists destroyed pools only.
720 .RE
721
722 .RE
723
724 .sp
725 .ne 2
726 .mk
727 .na
728 \fB\fBzpool import\fR [\fB-d\fR \fIdir\fR] [\fB-D\fR] [\fB-f\fR] [\fB-o\fR \fIopts\fR] [\fB-R\fR \fIroot\fR] \fIpool\fR | \fIid\fR [\fInewpool\fR]\fR
729 .ad
730 .sp .6
731 .RS 4n
732 Imports a specific pool. A pool can be identified by its name or the numeric identifier. If \fInewpool\fR is specified, the pool is imported using the name \fInewpool\fR. Otherwise, it is imported with the same name as its exported name.
733 .sp
734 If a device is removed from a system without running "\fBzpool export\fR" first, the device appears as potentially active. It cannot be determined if this was a failed export, or whether the device is really in use from another host. To import a pool in this state,
735 the \fB-f\fR option is required.
736 .sp
737 .ne 2
738 .mk
739 .na
740 \fB\fB-d\fR \fIdir\fR\fR
741 .ad
742 .RS 11n
743 .rt  
744 Searches for devices or files in \fIdir\fR. The \fB-d\fR option can be specified multiple times.
745 .RE
746
747 .sp
748 .ne 2
749 .mk
750 .na
751 \fB\fB-D\fR\fR
752 .ad
753 .RS 11n
754 .rt  
755 Imports destroyed pool. The \fB-f\fR option is also required.
756 .RE
757
758 .sp
759 .ne 2
760 .mk
761 .na
762 \fB\fB-f\fR\fR
763 .ad
764 .RS 11n
765 .rt  
766 Forces import, even if the pool appears to be potentially active.
767 .RE
768
769 .sp
770 .ne 2
771 .mk
772 .na
773 \fB\fB-o\fR \fIopts\fR\fR
774 .ad
775 .RS 11n
776 .rt  
777 Comma-separated list of mount options to use when mounting datasets within the pool. See \fBzfs\fR(1M) for a description of dataset properties and mount
778 options.
779 .RE
780
781 .sp
782 .ne 2
783 .mk
784 .na
785 \fB\fB-R\fR \fIroot\fR\fR
786 .ad
787 .RS 11n
788 .rt  
789 Imports pool(s) with an alternate \fIroot\fR. See the "Alternate Root Pools" section.
790 .RE
791
792 .RE
793
794 .sp
795 .ne 2
796 .mk
797 .na
798 \fB\fBzpool import\fR [\fB-d\fR \fIdir\fR] [\fB-D\fR] [\fB-f\fR] [\fB-a\fR]\fR
799 .ad
800 .sp .6
801 .RS 4n
802 Imports all pools found in the search directories. Identical to the previous command, except that all pools with a sufficient number of devices available are imported. Destroyed pools, pools that were previously destroyed with the "\fB-zpool destroy\fR" command,
803 will not be imported unless the \fB-D\fR option is specified.
804 .sp
805 .ne 2
806 .mk
807 .na
808 \fB\fB-d\fR \fIdir\fR\fR
809 .ad
810 .RS 10n
811 .rt  
812 Searches for devices or files in \fIdir\fR. The \fB-d\fR option can be specified multiple times.
813 .RE
814
815 .sp
816 .ne 2
817 .mk
818 .na
819 \fB\fB-D\fR\fR
820 .ad
821 .RS 10n
822 .rt  
823 Imports destroyed pools only. The \fB-f\fR option is also required.
824 .RE
825
826 .sp
827 .ne 2
828 .mk
829 .na
830 \fB\fB-f\fR\fR
831 .ad
832 .RS 10n
833 .rt  
834 Forces import, even if the pool appears to be potentially active.
835 .RE
836
837 .RE
838
839 .sp
840 .ne 2
841 .mk
842 .na
843 \fB\fBzpool upgrade\fR\fR
844 .ad
845 .sp .6
846 .RS 4n
847 Displays all pools formatted using a different \fBZFS\fR on-disk version. Older versions can continue to be used, but some features may not be available. These pools can be upgraded using "\fBzpool upgrade -a\fR". Pools that are formatted with
848 a more recent version are also displayed, although these pools will be inaccessible on the system.
849 .RE
850
851 .sp
852 .ne 2
853 .mk
854 .na
855 \fB\fBzpool upgrade\fR \fB-v\fR\fR
856 .ad
857 .sp .6
858 .RS 4n
859 Displays \fBZFS\fR versions supported by the current software. The current \fBZFS\fR versions and all previous supportedversions are displayed, along with an explanation of the features provided with each version.
860 .RE
861
862 .sp
863 .ne 2
864 .mk
865 .na
866 \fB\fBzpool upgrade\fR [\fB-a\fR | \fIpool\fR]\fR
867 .ad
868 .sp .6
869 .RS 4n
870 Upgrades the given pool to the latest on-disk version. Once this is done, the pool will no longer be accessible on systems running older versions of the software.
871 .sp
872 .ne 2
873 .mk
874 .na
875 \fB\fB-a\fR\fR
876 .ad
877 .RS 6n
878 .rt  
879 Upgrades all pools.
880 .RE
881
882 .RE
883
884 .sp
885 .ne 2
886 .mk
887 .na
888 \fB\fBzpool history\fR [\fIpool\fR] ...\fR
889 .ad
890 .sp .6
891 .RS 4n
892 Displays the command history of the specified pools (or all pools if no pool is specified).
893 .RE
894
895 .SH EXAMPLES
896 .LP
897 \fBExample 1 \fRCreating a RAID-Z Storage Pool
898 .LP
899 The following command creates a pool with a single \fBraidz\fR root \fIvdev\fR that consists of six disks.
900
901 .sp
902 .in +2
903 .nf
904 \fB# zpool create tank raidz c0t0d0 c0t1d0 c0t2d0 c0t3d0 c0t4d0 c0t5d0\fR
905 .fi
906 .in -2
907 .sp
908
909 .LP
910 \fBExample 2 \fRCreating a Mirrored Storage Pool
911 .LP
912 The following command creates a pool with two mirrors, where each mirror contains two disks.
913
914 .sp
915 .in +2
916 .nf
917 \fB# zpool create tank mirror c0t0d0 c0t1d0 mirror c0t2d0 c0t3d0\fR
918 .fi
919 .in -2
920 .sp
921
922 .LP
923 \fBExample 3 \fRCreating a ZFS Storage Pool by Using Slices
924 .LP
925 The following command creates an unmirrored pool using two disk slices.
926
927 .sp
928 .in +2
929 .nf
930 \fB# zpool create tank /dev/dsk/c0t0d0s1 c0t1d0s4\fR
931 .fi
932 .in -2
933 .sp
934
935 .LP
936 \fBExample 4 \fRCreating a ZFS Storage Pool by Using Files
937 .LP
938 The following command creates an unmirrored pool using files. While not recommended, a pool based on files can be useful for experimental purposes.
939
940 .sp
941 .in +2
942 .nf
943 \fB# zpool create tank /path/to/file/a /path/to/file/b\fR
944 .fi
945 .in -2
946 .sp
947
948 .LP
949 \fBExample 5 \fRAdding a Mirror to a ZFS Storage Pool
950 .LP
951 The following command adds two mirrored disks to the pool "\fItank\fR", assuming the pool is already made up of two-way mirrors. The additional space is immediately available to any datasets within the pool.
952
953 .sp
954 .in +2
955 .nf
956 \fB# zpool add tank mirror c1t0d0 c1t1d0\fR
957 .fi
958 .in -2
959 .sp
960
961 .LP
962 \fBExample 6 \fRListing Available ZFS Storage Pools
963 .LP
964 The following command lists all available pools on the system. In this case, the pool \fIzion\fR is faulted due to a missing device.
965
966 .LP
967 The results from this command are similar to the following:
968
969 .sp
970 .in +2
971 .nf
972 \fB# zpool list\fR
973     NAME              SIZE    USED   AVAIL    CAP  HEALTH     ALTROOT
974     pool             67.5G   2.92M   67.5G     0%  ONLINE     -
975     tank             67.5G   2.92M   67.5G     0%  ONLINE     -
976     zion                 -       -       -     0%  FAULTED    -
977 .fi
978 .in -2
979 .sp
980
981 .LP
982 \fBExample 7 \fRDestroying a ZFS Storage Pool
983 .LP
984 The following command destroys the pool "\fItank\fR" and any datasets contained within.
985
986 .sp
987 .in +2
988 .nf
989 \fB# zpool destroy -f tank\fR
990 .fi
991 .in -2
992 .sp
993
994 .LP
995 \fBExample 8 \fRExporting a ZFS Storage Pool
996 .LP
997 The following command exports the devices in pool \fItank\fR so that they can be relocated or later imported.
998
999 .sp
1000 .in +2
1001 .nf
1002 \fB# zpool export tank\fR
1003 .fi
1004 .in -2
1005 .sp
1006
1007 .LP
1008 \fBExample 9 \fRImporting a ZFS Storage Pool
1009 .LP
1010 The following command displays available pools, and then imports the pool "tank" for use on the system.
1011
1012 .LP
1013 The results from this command are similar to the following:
1014
1015 .sp
1016 .in +2
1017 .nf
1018 \fB# zpool import\fR
1019  pool: tank
1020    id: 15451357997522795478
1021 state: ONLINE
1022 action: The pool can be imported using its name or numeric identifier.
1023 config:
1024
1025        tank        ONLINE
1026          mirror    ONLINE
1027            c1t2d0  ONLINE
1028            c1t3d0  ONLINE
1029
1030 \fB# zpool import tank\fR
1031 .fi
1032 .in -2
1033 .sp
1034
1035 .LP
1036 \fBExample 10 \fRUpgrading All ZFS Storage Pools to the Current Version
1037 .LP
1038 The following command upgrades all ZFS Storage pools to the current version of the software.
1039
1040 .sp
1041 .in +2
1042 .nf
1043 \fB# zpool upgrade -a\fR
1044 This system is currently running ZFS version 2.
1045 .fi
1046 .in -2
1047 .sp
1048
1049 .LP
1050 \fBExample 11 \fRManaging Hot Spares
1051 .LP
1052 The following command creates a new pool with an available hot spare:
1053
1054 .sp
1055 .in +2
1056 .nf
1057 \fB# zpool create tank mirror c0t0d0 c0t1d0 spare c0t2d0\fR
1058 .fi
1059 .in -2
1060 .sp
1061
1062 .LP
1063 If one of the disks were to fail, the pool would be reduced to the degraded state. The failed device can be replaced using the following command:
1064
1065 .sp
1066 .in +2
1067 .nf
1068 \fB# zpool replace tank c0t0d0 c0t3d0\fR
1069 .fi
1070 .in -2
1071 .sp
1072
1073 .LP
1074 Once the data has been resilvered, the spare is automatically removed and is made available should another device fails.  The hot spare can be permanently removed from the pool using the following command:
1075
1076 .sp
1077 .in +2
1078 .nf
1079 \fB# zpool remove tank c0t2d0\fR
1080 .fi
1081 .in -2
1082 .sp
1083
1084 .SH EXIT STATUS
1085 .LP
1086 The following exit values are returned:
1087 .sp
1088 .ne 2
1089 .mk
1090 .na
1091 \fB\fB0\fR\fR
1092 .ad
1093 .RS 5n
1094 .rt  
1095 Successful completion. 
1096 .RE
1097
1098 .sp
1099 .ne 2
1100 .mk
1101 .na
1102 \fB\fB1\fR\fR
1103 .ad
1104 .RS 5n
1105 .rt  
1106 An error occurred.
1107 .RE
1108
1109 .sp
1110 .ne 2
1111 .mk
1112 .na
1113 \fB\fB2\fR\fR
1114 .ad
1115 .RS 5n
1116 .rt  
1117 Invalid command line options were specified.
1118 .RE
1119
1120 .SH ATTRIBUTES
1121 .LP
1122 See \fBattributes\fR(5) for descriptions of the following attributes:
1123 .sp
1124
1125 .sp
1126 .TS
1127 tab(\a) box;
1128 cw(2.75i) |cw(2.75i) 
1129 lw(2.75i) |lw(2.75i) 
1130 .
1131 ATTRIBUTE TYPE\aATTRIBUTE VALUE
1132 _
1133 Availability\aSUNWzfsu
1134 _
1135 Interface Stability\aEvolving
1136 .TE
1137
1138 .SH SEE ALSO
1139 .LP
1140 \fBzfs\fR(1M), \fBattributes\fR(5)