Add the '-a' option to 'zpool export'

Support exporting all imported pools in one go, using 'zpool export -a'.

This is accomplished by moving the export parts from zpool_do_export()
in to the new function zpool_export_one().  The for_each_pool() function
is used to enumerate the list of pools to be exported.  Passing an argc
of 0 implies the function should be called on all pools.

Signed-off-by: Turbo Fredriksson <turbo@bayour.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes: #3203
This commit is contained in:
Turbo Fredriksson
2015-03-20 23:29:14 +01:00
committed by Brian Behlendorf
parent 0c60cc326b
commit 859735c095
2 changed files with 67 additions and 34 deletions
+16 -3
View File
@@ -57,7 +57,7 @@ zpool \- configures ZFS storage pools
.LP
.nf
\fBzpool export\fR [\fB-f\fR] \fIpool\fR ...
\fBzpool export\fR [\fB-a\fR] [\fB-f\fR] \fIpool\fR ...
.fi
.LP
@@ -1059,11 +1059,13 @@ Forces any active datasets contained within the pool to be unmounted.
Detaches \fIdevice\fR from a mirror. The operation is refused if there are no other valid replicas of the data. If \fIdevice\fR may be re-added to the pool later on then consider the "\fBzpool offline\fR" command instead.
.RE
.RE
.sp
.ne 2
.mk
.na
\fB\fBzpool export\fR [\fB-f\fR] \fIpool\fR ...\fR
\fB\fBzpool export\fR [\fB-a\fR] [\fB-f\fR] \fIpool\fR ...\fR
.ad
.sp .6
.RS 4n
@@ -1072,6 +1074,17 @@ Exports the given pools from the system. All devices are marked as exported, but
Before exporting the pool, all datasets within the pool are unmounted. A pool can not be exported if it has a shared spare that is currently being used.
.sp
For pools to be portable, you must give the \fBzpool\fR command whole disks, not just partitions, 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.
.sp
.ne 2
.mk
.na
\fB\fB-a\fR\fR
.ad
.RS 6n
.rt
Exports all pools imported on the system.
.RE
.sp
.ne 2
.mk
@@ -1079,7 +1092,7 @@ For pools to be portable, you must give the \fBzpool\fR command whole disks, not
\fB\fB-f\fR\fR
.ad
.RS 6n
.rt
.rt
Forcefully unmount all datasets, using the "\fBunmount -f\fR" command.
.sp
This command will forcefully export the pool even if it has a shared spare that is currently being used. This may lead to potential data corruption.