aboutsummaryrefslogtreecommitdiff
path: root/tools/regression/zfs/zpool
diff options
context:
space:
mode:
Diffstat (limited to 'tools/regression/zfs/zpool')
-rw-r--r--tools/regression/zfs/zpool/add/cache.t125
-rw-r--r--tools/regression/zfs/zpool/add/disks.t59
-rw-r--r--tools/regression/zfs/zpool/add/doesnt_exist.t19
-rw-r--r--tools/regression/zfs/zpool/add/files.t230
-rw-r--r--tools/regression/zfs/zpool/add/log.t283
-rw-r--r--tools/regression/zfs/zpool/add/mirror.t85
-rw-r--r--tools/regression/zfs/zpool/add/option-f_inuse.t1185
-rw-r--r--tools/regression/zfs/zpool/add/option-f_replication_level_mismatch_0.t160
-rw-r--r--tools/regression/zfs/zpool/add/option-f_replication_level_mismatch_1.t784
-rw-r--r--tools/regression/zfs/zpool/add/option-f_size_mismatch.t433
-rw-r--r--tools/regression/zfs/zpool/add/option-f_type_mismatch.t407
-rw-r--r--tools/regression/zfs/zpool/add/option-n.t33
-rw-r--r--tools/regression/zfs/zpool/add/raidz1.t69
-rw-r--r--tools/regression/zfs/zpool/add/raidz2.t76
-rw-r--r--tools/regression/zfs/zpool/add/spare.t136
-rw-r--r--tools/regression/zfs/zpool/attach/log.t231
-rw-r--r--tools/regression/zfs/zpool/attach/mirror.t207
-rw-r--r--tools/regression/zfs/zpool/attach/option-f_inuse.t669
-rw-r--r--tools/regression/zfs/zpool/create/already_exists.t27
-rw-r--r--tools/regression/zfs/zpool/create/automount.t21
-rw-r--r--tools/regression/zfs/zpool/create/cache.t125
-rw-r--r--tools/regression/zfs/zpool/create/disks.t51
-rw-r--r--tools/regression/zfs/zpool/create/files.t188
-rw-r--r--tools/regression/zfs/zpool/create/log.t201
-rw-r--r--tools/regression/zfs/zpool/create/mirror.t82
-rw-r--r--tools/regression/zfs/zpool/create/option-R.t29
-rw-r--r--tools/regression/zfs/zpool/create/option-f_inuse.t296
-rw-r--r--tools/regression/zfs/zpool/create/option-f_replication_level_mismatch_0.t199
-rw-r--r--tools/regression/zfs/zpool/create/option-f_replication_level_mismatch_1.t539
-rw-r--r--tools/regression/zfs/zpool/create/option-f_size_mismatch.t255
-rw-r--r--tools/regression/zfs/zpool/create/option-f_type_mismatch.t413
-rw-r--r--tools/regression/zfs/zpool/create/option-m.t58
-rw-r--r--tools/regression/zfs/zpool/create/option-n.t22
-rw-r--r--tools/regression/zfs/zpool/create/option-o.t106
-rw-r--r--tools/regression/zfs/zpool/create/raidz1.t128
-rw-r--r--tools/regression/zfs/zpool/create/raidz2.t90
-rw-r--r--tools/regression/zfs/zpool/create/spare.t103
-rw-r--r--tools/regression/zfs/zpool/offline/io.t84
-rw-r--r--tools/regression/zfs/zpool/offline/log.t253
-rw-r--r--tools/regression/zfs/zpool/offline/mirror.t223
-rw-r--r--tools/regression/zfs/zpool/offline/option-t.t1109
-rw-r--r--tools/regression/zfs/zpool/offline/raidz1.t183
-rw-r--r--tools/regression/zfs/zpool/offline/raidz2.t201
-rw-r--r--tools/regression/zfs/zpool/remove/cache.t57
-rw-r--r--tools/regression/zfs/zpool/remove/spare.t105
-rw-r--r--tools/regression/zfs/zpool/replace/cache.t42
-rw-r--r--tools/regression/zfs/zpool/replace/disk.t47
-rw-r--r--tools/regression/zfs/zpool/replace/log.t151
-rw-r--r--tools/regression/zfs/zpool/replace/mirror.t133
-rw-r--r--tools/regression/zfs/zpool/replace/raidz1.t139
-rw-r--r--tools/regression/zfs/zpool/replace/raidz2.t606
-rw-r--r--tools/regression/zfs/zpool/replace/spare.t42
52 files changed, 11499 insertions, 0 deletions
diff --git a/tools/regression/zfs/zpool/add/cache.t b/tools/regression/zfs/zpool/add/cache.t
new file mode 100644
index 000000000000..af5e4936341e
--- /dev/null
+++ b/tools/regression/zfs/zpool/add/cache.t
@@ -0,0 +1,125 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..33"
+
+disks_create 6
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_fl ${ZPOOL} add ${name0} cache ${disk0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} cache ${disk1}
+expect_fl ${ZPOOL} add ${name0} cache ${disk1}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_ok ${ZPOOL} add ${name0} cache ${disk1}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " cache"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} cache ${disk1}
+expect_ok ${ZPOOL} add ${name0} cache ${disk2}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " cache"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} cache ${disk2} ${disk3}
+expect_ok ${ZPOOL} add ${name0} cache ${disk4}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " cache"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2} cache ${disk3}
+expect_ok ${ZPOOL} add ${name0} cache ${disk4}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " cache"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3} cache ${disk4}
+expect_ok ${ZPOOL} add ${name0} cache ${disk5}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " cache"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/add/disks.t b/tools/regression/zfs/zpool/add/disks.t
new file mode 100644
index 000000000000..0a1e9658351f
--- /dev/null
+++ b/tools/regression/zfs/zpool/add/disks.t
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..19"
+
+disks_create 5
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_fl ${ZPOOL} add ${name0} ${disk0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} ${disk1}
+expect_fl ${ZPOOL} add ${name0} ${disk0}
+expect_fl ${ZPOOL} add ${name0} ${disk1}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_ok ${ZPOOL} add ${name0} ${disk1}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} add ${name0} ${disk3} ${disk4}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/add/doesnt_exist.t b/tools/regression/zfs/zpool/add/doesnt_exist.t
new file mode 100644
index 000000000000..589dd31b4097
--- /dev/null
+++ b/tools/regression/zfs/zpool/add/doesnt_exist.t
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..6"
+
+disks_create 1
+names_create 1
+
+expect_fl ${ZPOOL} add ${name0} ${disk0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} add -f ${name0} ${disk0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/add/files.t b/tools/regression/zfs/zpool/add/files.t
new file mode 100644
index 000000000000..624bb7893069
--- /dev/null
+++ b/tools/regression/zfs/zpool/add/files.t
@@ -0,0 +1,230 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..54"
+
+files_create 8
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} ${file0}
+expect_fl ${ZPOOL} add ${name0} ${file0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${file0} ${file1}
+expect_fl ${ZPOOL} add ${name0} ${file0}
+expect_fl ${ZPOOL} add ${name0} ${file1}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${file0}
+expect_ok ${ZPOOL} add ${name0} ${file1}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${file0} ${file1} ${file2}
+expect_ok ${ZPOOL} add ${name0} ${file3} ${file4}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo " ${file2} ONLINE 0 0 0"
+ echo " ${file3} ONLINE 0 0 0"
+ echo " ${file4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${file0} ${file1}
+expect_ok ${ZPOOL} add ${name0} mirror ${file2} ${file3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${file2} ONLINE 0 0 0"
+ echo " ${file3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${file0} ${file1} ${file2}
+expect_ok ${ZPOOL} add ${name0} raidz1 ${file3} ${file4} ${file5}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo " ${file2} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${file3} ONLINE 0 0 0"
+ echo " ${file4} ONLINE 0 0 0"
+ echo " ${file5} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${file0} ${file1} ${file2} ${file3}
+expect_ok ${ZPOOL} add ${name0} raidz2 ${file4} ${file5} ${file6} ${file7}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo " ${file2} ONLINE 0 0 0"
+ echo " ${file3} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${file4} ONLINE 0 0 0"
+ echo " ${file5} ONLINE 0 0 0"
+ echo " ${file6} ONLINE 0 0 0"
+ echo " ${file7} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${file0} ${file1}
+expect_ok ${ZPOOL} add ${name0} spare ${file2} ${file3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo " spares"
+ echo " ${file2} AVAIL"
+ echo " ${file3} AVAIL"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${file0} ${file1}
+expect_ok ${ZPOOL} add ${name0} log ${file2} ${file3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " ${file2} ONLINE 0 0 0"
+ echo " ${file3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${file0} ${file1}
+expect_ok ${ZPOOL} add ${name0} log mirror ${file2} ${file3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${file2} ONLINE 0 0 0"
+ echo " ${file3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${file0} ${file1}
+expect_fl ${ZPOOL} add ${name0} cache ${file2} ${file3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+files_destroy
diff --git a/tools/regression/zfs/zpool/add/log.t b/tools/regression/zfs/zpool/add/log.t
new file mode 100644
index 000000000000..289468801a75
--- /dev/null
+++ b/tools/regression/zfs/zpool/add/log.t
@@ -0,0 +1,283 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..66"
+
+disks_create 7
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_ok ${ZPOOL} add ${name0} log ${disk1}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_ok ${ZPOOL} add ${name0} log mirror ${disk1} ${disk2} ${disk3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} add ${name0} log ${disk2}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} add ${name0} log mirror ${disk2} ${disk3} ${disk4}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} add ${name0} log ${disk3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} add ${name0} log mirror ${disk3} ${disk4} ${disk5}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} add ${name0} log ${disk4}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} add ${name0} log mirror ${disk4} ${disk5} ${disk6}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_ok ${ZPOOL} add ${name0} log ${disk1}
+expect_ok ${ZPOOL} add ${name0} log ${disk2}
+expect_ok ${ZPOOL} add ${name0} log ${disk3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_ok ${ZPOOL} add ${name0} log mirror ${disk1} ${disk2}
+expect_ok ${ZPOOL} add ${name0} log mirror ${disk3} ${disk4}
+expect_ok ${ZPOOL} add ${name0} log mirror ${disk5} ${disk6}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log ${disk1}
+expect_ok ${ZPOOL} add ${name0} log ${disk2}
+expect_ok ${ZPOOL} add ${name0} log ${disk3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2}
+expect_ok ${ZPOOL} add ${name0} log mirror ${disk3} ${disk4}
+expect_ok ${ZPOOL} add ${name0} log mirror ${disk5} ${disk6}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/add/mirror.t b/tools/regression/zfs/zpool/add/mirror.t
new file mode 100644
index 000000000000..34a89cff3bf0
--- /dev/null
+++ b/tools/regression/zfs/zpool/add/mirror.t
@@ -0,0 +1,85 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..15"
+
+disks_create 10
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} add ${name0} mirror ${disk2} ${disk3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} add ${name0} mirror ${disk3} ${disk4} ${disk5}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} mirror ${disk2} ${disk3}
+expect_ok ${ZPOOL} add ${name0} mirror ${disk4} ${disk5} mirror ${disk6} ${disk7} mirror ${disk8} ${disk9}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo " ${disk7} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk8} ONLINE 0 0 0"
+ echo " ${disk9} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/add/option-f_inuse.t b/tools/regression/zfs/zpool/add/option-f_inuse.t
new file mode 100644
index 000000000000..2d5a7db480dc
--- /dev/null
+++ b/tools/regression/zfs/zpool/add/option-f_inuse.t
@@ -0,0 +1,1185 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..263"
+
+disks_create 11
+names_create 2
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} create ${name1} ${disk1}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of exported pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} add ${name1} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} add -f ${name1} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} create ${name1} ${disk1}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of exported pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} add ${name1} ${disk2} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} add -f ${name1} ${disk2} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} create ${name1} mirror ${disk2} ${disk3}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of exported pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} add ${name1} mirror ${disk0} ${disk1}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} add -f ${name1} mirror ${disk0} ${disk1}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} create ${name1} mirror ${disk1} ${disk2}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of exported pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} add ${name1} mirror ${disk3} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} add -f ${name1} mirror ${disk3} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} create ${name1} raidz1 ${disk3} ${disk4} ${disk5}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of exported pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} add ${name1} raidz1 ${disk0} ${disk1} ${disk2}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} add -f ${name1} raidz1 ${disk0} ${disk1} ${disk2}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} create ${name1} raidz1 ${disk1} ${disk2} ${disk3}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of exported pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} add ${name1} raidz1 ${disk4} ${disk5} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} add -f ${name1} raidz1 ${disk4} ${disk5} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} create ${name1} raidz2 ${disk4} ${disk5} ${disk6} ${disk7}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of exported pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} add ${name1} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo " ${disk7} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} add -f ${name1} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo " ${disk7} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} create ${name1} raidz2 ${disk1} ${disk2} ${disk3} ${disk4}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of exported pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} add ${name1} raidz2 ${disk5} ${disk6} ${disk0} ${disk7}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} add -f ${name1} raidz2 ${disk5} ${disk6} ${disk0} ${disk7}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk7} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} create ${name1} ${disk1}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of exported pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} add ${name1} log ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} add -f ${name1} log ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} create ${name1} ${disk1}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of exported pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} add ${name1} log ${disk2} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} add -f ${name1} log ${disk2} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log ${disk1}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} create ${name1} ${disk2}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk1} is part of exported pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} add ${name1} log mirror ${disk1} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} add -f ${name1} log mirror ${disk1} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} create ${name1} ${disk1}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of exported pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} add ${name1} log mirror ${disk2} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} add -f ${name1} log mirror ${disk2} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+
+expect_ok ${ZPOOL} create ${name0} ${disk1} cache ${disk0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} create ${name1} ${disk2}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of exported pool '${name0}'"
+)`
+add_msg="# TODO It shouldn't be possible to use offlined cache vdevs."
+expect "${exp}" ${ZPOOL} add ${name1} cache ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} add -f ${name1} cache ${disk0}
+add_msg=""
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " cache"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} import ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk1} cache ${disk0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} create ${name1} ${disk2}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of exported pool '${name0}'"
+)`
+add_msg="# TODO It shouldn't be possible to use offlined cache vdevs."
+expect "${exp}" ${ZPOOL} add ${name1} cache ${disk3} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} add -f ${name1} cache ${disk3} ${disk0}
+add_msg=""
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " cache"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} import ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} create ${name1} ${disk2}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of potentially active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} add ${name1} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} add -f ${name1} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} import ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} create ${name1} mirror ${disk2} ${disk3}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of potentially active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} add ${name1} mirror ${disk0} ${disk4}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} add -f ${name1} mirror ${disk0} ${disk4}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} import ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} create ${name1} raidz1 ${disk3} ${disk4} ${disk5}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of potentially active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} add ${name1} raidz1 ${disk0} ${disk6} ${disk7}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} add -f ${name1} raidz1 ${disk0} ${disk6} ${disk7}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo " ${disk7} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} import ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} create ${name1} raidz2 ${disk4} ${disk5} ${disk6} ${disk7}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of potentially active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} add ${name1} raidz2 ${disk0} ${disk8} ${disk9} ${disk10}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo " ${disk7} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} add -f ${name1} raidz2 ${disk0} ${disk8} ${disk9} ${disk10}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo " ${disk7} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk8} ONLINE 0 0 0"
+ echo " ${disk9} ONLINE 0 0 0"
+ echo " ${disk10} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} import ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} create ${name1} ${disk2}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of potentially active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} add ${name1} log ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} add -f ${name1} log ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} import ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2}
+expect_ok ${ZPOOL} offline ${name0} ${disk1}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} create ${name1} ${disk3}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk1} is part of potentially active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} add ${name1} log mirror ${disk1} ${disk4}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} add -f ${name1} log mirror ${disk1} ${disk4}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} import ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk1} cache ${disk0}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} create ${name1} ${disk2}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of potentially active pool '${name0}'"
+)`
+add_msg="# TODO It shouldn't be possible to use offlined cache vdevs."
+expect "${exp}" ${ZPOOL} add ${name1} cache ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} add -f ${name1} cache ${disk0}
+add_msg=""
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " cache"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} import ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+expect_ok ${ZPOOL} create ${name1} ${disk2}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} add ${name1} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+exp=`(
+ echo "invalid vdev specification"
+ echo "the following errors must be manually repaired:"
+ echo "${fdisk0} is part of active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} add -f ${name1} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} online ${name0} ${disk0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+expect_ok ${ZPOOL} create ${name1} mirror ${disk2} ${disk3}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} add ${name1} mirror ${disk0} ${disk4}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+exp=`(
+ echo "invalid vdev specification"
+ echo "the following errors must be manually repaired:"
+ echo "${fdisk0} is part of active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} add -f ${name1} mirror ${disk0} ${disk4}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} online ${name0} ${disk0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+expect_ok ${ZPOOL} create ${name1} raidz1 ${disk3} ${disk4} ${disk5}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} add ${name1} raidz1 ${disk0} ${disk6} ${disk7}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+exp=`(
+ echo "invalid vdev specification"
+ echo "the following errors must be manually repaired:"
+ echo "${fdisk0} is part of active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} add -f ${name1} raidz1 ${disk0} ${disk6} ${disk7}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} online ${name0} ${disk0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+expect_ok ${ZPOOL} create ${name1} raidz2 ${disk4} ${disk5} ${disk6} ${disk7}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} add ${name1} raidz2 ${disk0} ${disk8} ${disk9} ${disk10}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo " ${disk7} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+exp=`(
+ echo "invalid vdev specification"
+ echo "the following errors must be manually repaired:"
+ echo "${fdisk0} is part of active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} add -f ${name1} raidz2 ${disk0} ${disk8} ${disk9} ${disk10}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo " ${disk7} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} online ${name0} ${disk0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+expect_ok ${ZPOOL} create ${name1} ${disk2}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} add ${name1} log ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+exp=`(
+ echo "invalid vdev specification"
+ echo "the following errors must be manually repaired:"
+ echo "${fdisk0} is part of active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} add -f ${name1} log ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} online ${name0} ${disk0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2}
+expect_ok ${ZPOOL} offline ${name0} ${disk1}
+expect_ok ${ZPOOL} create ${name1} ${disk3}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk1} is part of active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} add ${name1} log mirror ${disk1} ${disk4}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+exp=`(
+ echo "invalid vdev specification"
+ echo "the following errors must be manually repaired:"
+ echo "${fdisk1} is part of active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} add -f ${name1} log mirror ${disk1} ${disk4}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} online ${name0} ${disk1}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk1} cache ${disk0}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+expect_ok ${ZPOOL} create ${name1} ${disk2}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of active pool '${name0}'"
+)`
+add_msg="# TODO It reports that ${fdisk0} is part of unknown pool."
+expect "${exp}" ${ZPOOL} add ${name1} cache ${disk0}
+add_msg=""
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+add_msg="# TODO Invalid problem description."
+exp=`(
+ echo "invalid vdev specification"
+ echo "the following errors must be manually repaired:"
+ echo "${fdisk0} is part of active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} add -f ${name1} cache ${disk0}
+add_msg=""
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} online ${name0} ${disk0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/add/option-f_replication_level_mismatch_0.t b/tools/regression/zfs/zpool/add/option-f_replication_level_mismatch_0.t
new file mode 100644
index 000000000000..5d3a649b2205
--- /dev/null
+++ b/tools/regression/zfs/zpool/add/option-f_replication_level_mismatch_0.t
@@ -0,0 +1,160 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..40"
+
+disks_create 5
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_fl ${ZPOOL} add ${name0} mirror ${disk1} ${disk2}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_ok ${ZPOOL} add -f ${name0} mirror ${disk1} ${disk2}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_fl ${ZPOOL} add ${name0} raidz ${disk1} ${disk2} ${disk3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_ok ${ZPOOL} add -f ${name0} raidz ${disk1} ${disk2} ${disk3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_fl ${ZPOOL} add ${name0} raidz2 ${disk1} ${disk2} ${disk3} ${disk4}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_ok ${ZPOOL} add -f ${name0} raidz2 ${disk1} ${disk2} ${disk3} ${disk4}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log ${disk1}
+add_msg="# TODO Sun CR 6726091, Lustre bug 16873"
+expect_fl ${ZPOOL} add ${name0} log mirror ${disk2} ${disk3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+add_msg=""
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log ${disk1}
+expect_ok ${ZPOOL} add -f ${name0} log mirror ${disk2} ${disk3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/add/option-f_replication_level_mismatch_1.t b/tools/regression/zfs/zpool/add/option-f_replication_level_mismatch_1.t
new file mode 100644
index 000000000000..97258f2ed770
--- /dev/null
+++ b/tools/regression/zfs/zpool/add/option-f_replication_level_mismatch_1.t
@@ -0,0 +1,784 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..182"
+
+disks_create 9
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_fl ${ZPOOL} add ${name0} mirror ${disk2} ${disk3} ${disk4}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} add -f ${name0} mirror ${disk2} ${disk3} ${disk4}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} ${disk2}
+expect_fl ${ZPOOL} add ${name0} mirror ${disk3} ${disk4}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} add -f ${name0} mirror ${disk3} ${disk4}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2}
+expect_fl ${ZPOOL} add ${name0} raidz1 ${disk3} ${disk4} ${disk5} ${disk6}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} add -f ${name0} raidz1 ${disk3} ${disk4} ${disk5} ${disk6}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_fl ${ZPOOL} add ${name0} raidz1 ${disk4} ${disk5} ${disk6}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} add -f ${name0} raidz1 ${disk4} ${disk5} ${disk6}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_fl ${ZPOOL} add ${name0} raidz2 ${disk4} ${disk5} ${disk6} ${disk7} ${disk8}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} add -f ${name0} raidz2 ${disk4} ${disk5} ${disk6} ${disk7} ${disk8}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo " ${disk7} ONLINE 0 0 0"
+ echo " ${disk8} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3} ${disk4}
+expect_fl ${ZPOOL} add ${name0} raidz2 ${disk5} ${disk6} ${disk7} ${disk8}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3} ${disk4}
+expect_ok ${ZPOOL} add -f ${name0} raidz2 ${disk5} ${disk6} ${disk7} ${disk8}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo " ${disk7} ONLINE 0 0 0"
+ echo " ${disk8} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+
+
+
+
+
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_fl ${ZPOOL} add ${name0} raidz ${disk2} ${disk3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} add -f ${name0} raidz ${disk2} ${disk3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz ${disk0} ${disk1}
+expect_fl ${ZPOOL} add ${name0} mirror ${disk2} ${disk3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz ${disk0} ${disk1}
+expect_ok ${ZPOOL} add -f ${name0} mirror ${disk2} ${disk3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} ${disk2}
+expect_fl ${ZPOOL} add ${name0} raidz ${disk3} ${disk4}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} add -f ${name0} raidz ${disk3} ${disk4}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_fl ${ZPOOL} add ${name0} raidz ${disk2} ${disk3} ${disk4}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} add -f ${name0} raidz ${disk2} ${disk3} ${disk4}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_fl ${ZPOOL} add ${name0} raidz2 ${disk2} ${disk3} ${disk4}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} add -f ${name0} raidz2 ${disk2} ${disk3} ${disk4}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} ${disk2}
+expect_fl ${ZPOOL} add ${name0} raidz2 ${disk3} ${disk4} ${disk5}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} add -f ${name0} raidz2 ${disk3} ${disk4} ${disk5}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} ${disk2} ${disk3}
+expect_fl ${ZPOOL} add ${name0} raidz2 ${disk4} ${disk5} ${disk6}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} add -f ${name0} raidz2 ${disk4} ${disk5} ${disk6}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1}
+expect_fl ${ZPOOL} add ${name0} raidz2 ${disk2} ${disk3} ${disk4}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1}
+expect_ok ${ZPOOL} add -f ${name0} raidz2 ${disk2} ${disk3} ${disk4}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2}
+expect_fl ${ZPOOL} add ${name0} raidz2 ${disk3} ${disk4} ${disk5}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} add -f ${name0} raidz2 ${disk3} ${disk4} ${disk5}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_fl ${ZPOOL} add ${name0} raidz2 ${disk4} ${disk5} ${disk6}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} add -f ${name0} raidz2 ${disk4} ${disk5} ${disk6}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2}
+add_msg="# TODO Sun CR 6726091, Lustre bug 16873"
+expect_fl ${ZPOOL} add ${name0} log mirror ${disk3} ${disk4} ${disk5}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+add_msg=""
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2}
+expect_ok ${ZPOOL} add -f ${name0} log mirror ${disk3} ${disk4} ${disk5}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2} ${disk3}
+add_msg="# TODO Sun CR 6726091, Lustre bug 16873"
+expect_fl ${ZPOOL} add ${name0} log mirror ${disk4} ${disk5}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+add_msg=""
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} add -f ${name0} log mirror ${disk4} ${disk5}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/add/option-f_size_mismatch.t b/tools/regression/zfs/zpool/add/option-f_size_mismatch.t
new file mode 100644
index 000000000000..e16258e956aa
--- /dev/null
+++ b/tools/regression/zfs/zpool/add/option-f_size_mismatch.t
@@ -0,0 +1,433 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..100"
+
+disks_create 7
+disks_create 1 64M
+files_create 7
+files_create 1 64M
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_fl ${ZPOOL} add ${name0} mirror ${disk7} ${disk2}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} add -f ${name0} mirror ${disk7} ${disk2}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk7} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${file0} ${file1}
+expect_fl ${ZPOOL} add ${name0} mirror ${file7} ${file2}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${file0} ${file1}
+expect_ok ${ZPOOL} add -f ${name0} mirror ${file7} ${file2}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${file7} ONLINE 0 0 0"
+ echo " ${file2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2}
+expect_fl ${ZPOOL} add ${name0} raidz1 ${disk3} ${disk7} ${disk4}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} add -f ${name0} raidz1 ${disk3} ${disk7} ${disk4}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk7} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${file0} ${file1} ${file2}
+expect_fl ${ZPOOL} add ${name0} raidz1 ${file3} ${file7} ${file4}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo " ${file2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${file0} ${file1} ${file2}
+expect_ok ${ZPOOL} add -f ${name0} raidz1 ${file3} ${file7} ${file4}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo " ${file2} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${file3} ONLINE 0 0 0"
+ echo " ${file7} ONLINE 0 0 0"
+ echo " ${file4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_fl ${ZPOOL} add ${name0} raidz2 ${disk4} ${disk5} ${disk6} ${disk7}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} add -f ${name0} raidz2 ${disk4} ${disk5} ${disk6} ${disk7}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo " ${disk7} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${file0} ${file1} ${file2} ${file3}
+expect_fl ${ZPOOL} add ${name0} raidz2 ${file4} ${file5} ${file6} ${file7}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo " ${file2} ONLINE 0 0 0"
+ echo " ${file3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${file0} ${file1} ${file2} ${file3}
+expect_ok ${ZPOOL} add -f ${name0} raidz2 ${file4} ${file5} ${file6} ${file7}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo " ${file2} ONLINE 0 0 0"
+ echo " ${file3} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${file4} ONLINE 0 0 0"
+ echo " ${file5} ONLINE 0 0 0"
+ echo " ${file6} ONLINE 0 0 0"
+ echo " ${file7} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+add_msg="# TODO Sun CR 6726091, Lustre bug 16873"
+expect_fl ${ZPOOL} add ${name0} log mirror ${disk1} ${disk7}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+add_msg=""
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_ok ${ZPOOL} add -f ${name0} log mirror ${disk1} ${disk7}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk7} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${file0}
+add_msg="# TODO Sun CR 6726091, Lustre bug 16873"
+expect_fl ${ZPOOL} add ${name0} log mirror ${file1} ${file7}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+add_msg=""
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${file0}
+expect_ok ${ZPOOL} add -f ${name0} log mirror ${file1} ${file7}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo " ${file7} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2}
+add_msg="# TODO Sun CR 6726091, Lustre bug 16873"
+expect_fl ${ZPOOL} add ${name0} log mirror ${disk3} ${disk7}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+add_msg=""
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2}
+expect_ok ${ZPOOL} add -f ${name0} log mirror ${disk3} ${disk7}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk7} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${file0} log mirror ${file1} ${file2}
+add_msg="# TODO Sun CR 6726091, Lustre bug 16873"
+expect_fl ${ZPOOL} add ${name0} log mirror ${file3} ${file7}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo " ${file2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+add_msg=""
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${file0} log mirror ${file1} ${file2}
+expect_ok ${ZPOOL} add -f ${name0} log mirror ${file3} ${file7}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo " ${file2} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${file3} ONLINE 0 0 0"
+ echo " ${file7} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+disks_destroy
+files_destroy
diff --git a/tools/regression/zfs/zpool/add/option-f_type_mismatch.t b/tools/regression/zfs/zpool/add/option-f_type_mismatch.t
new file mode 100644
index 000000000000..7187001d2fba
--- /dev/null
+++ b/tools/regression/zfs/zpool/add/option-f_type_mismatch.t
@@ -0,0 +1,407 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..100"
+
+disks_create 7
+files_create 7
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_fl ${ZPOOL} add ${name0} ${file0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_ok ${ZPOOL} add -f ${name0} ${file0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${file0}
+expect_fl ${ZPOOL} add ${name0} ${disk0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${file0}
+expect_ok ${ZPOOL} add -f ${name0} ${disk0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_fl ${ZPOOL} add ${name0} mirror ${disk2} ${file0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} add -f ${name0} mirror ${disk2} ${file0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${file0} ${file1}
+expect_fl ${ZPOOL} add ${name0} mirror ${disk0} ${file2}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${file0} ${file1}
+expect_ok ${ZPOOL} add -f ${name0} mirror ${disk0} ${file2}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${file2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2}
+expect_fl ${ZPOOL} add ${name0} raidz1 ${disk3} ${file0} ${disk4}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} add -f ${name0} raidz1 ${disk3} ${file0} ${disk4}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${file0} ${file1} ${file2}
+expect_fl ${ZPOOL} add ${name0} raidz1 ${file3} ${disk0} ${file4}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo " ${file2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${file0} ${file1} ${file2}
+expect_ok ${ZPOOL} add -f ${name0} raidz1 ${file3} ${disk0} ${file4}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo " ${file2} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${file3} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${file4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_fl ${ZPOOL} add ${name0} raidz2 ${disk4} ${file0} ${disk5} ${disk6}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} add -f ${name0} raidz2 ${disk4} ${file0} ${disk5} ${disk6}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${file0} ${file1} ${file2} ${file3}
+expect_fl ${ZPOOL} add ${name0} raidz2 ${file4} ${disk0} ${file5} ${file6}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo " ${file2} ONLINE 0 0 0"
+ echo " ${file3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${file0} ${file1} ${file2} ${file3}
+expect_ok ${ZPOOL} add -f ${name0} raidz2 ${file4} ${disk0} ${file5} ${file6}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo " ${file2} ONLINE 0 0 0"
+ echo " ${file3} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${file4} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${file5} ONLINE 0 0 0"
+ echo " ${file6} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+add_msg="# TODO Sun CR 6726091, Lustre bug 16873"
+expect_fl ${ZPOOL} add ${name0} log mirror ${disk1} ${file0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+add_msg=""
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_ok ${ZPOOL} add -f ${name0} log mirror ${disk1} ${file0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${file0}
+add_msg="# TODO Sun CR 6726091, Lustre bug 16873"
+expect_fl ${ZPOOL} add ${name0} log mirror ${file1} ${disk0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+add_msg=""
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${file0}
+expect_ok ${ZPOOL} add -f ${name0} log mirror ${file1} ${disk0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+disks_destroy
+files_destroy
diff --git a/tools/regression/zfs/zpool/add/option-n.t b/tools/regression/zfs/zpool/add/option-n.t
new file mode 100644
index 000000000000..001a596137f0
--- /dev/null
+++ b/tools/regression/zfs/zpool/add/option-n.t
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..5"
+
+disks_create 2
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+exp=`(
+ echo "would update '${name0}' to the following configuration:"
+ echo " ${name0}"
+ echo " ${disk0}"
+ echo " ${disk1}"
+)`
+expect "${exp}" ${ZPOOL} add -n ${name0} ${disk1}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/add/raidz1.t b/tools/regression/zfs/zpool/add/raidz1.t
new file mode 100644
index 000000000000..ae986e5b54fc
--- /dev/null
+++ b/tools/regression/zfs/zpool/add/raidz1.t
@@ -0,0 +1,69 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..10"
+
+disks_create 15
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} add ${name0} raidz1 ${disk3} ${disk4} ${disk5}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2} raidz1 ${disk3} ${disk4} ${disk5}
+expect_ok ${ZPOOL} add ${name0} raidz1 ${disk6} ${disk7} ${disk8} raidz1 ${disk9} ${disk10} ${disk11} raidz1 ${disk12} ${disk13} ${disk14}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo " ${disk7} ONLINE 0 0 0"
+ echo " ${disk8} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk9} ONLINE 0 0 0"
+ echo " ${disk10} ONLINE 0 0 0"
+ echo " ${disk11} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk12} ONLINE 0 0 0"
+ echo " ${disk13} ONLINE 0 0 0"
+ echo " ${disk14} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/add/raidz2.t b/tools/regression/zfs/zpool/add/raidz2.t
new file mode 100644
index 000000000000..20a9fb5ae7d1
--- /dev/null
+++ b/tools/regression/zfs/zpool/add/raidz2.t
@@ -0,0 +1,76 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..10"
+
+disks_create 20
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} add ${name0} raidz2 ${disk4} ${disk5} ${disk6} ${disk7}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo " ${disk7} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3} raidz2 ${disk4} ${disk5} ${disk6} ${disk7}
+expect_ok ${ZPOOL} add ${name0} raidz2 ${disk8} ${disk9} ${disk10} ${disk11} raidz2 ${disk12} ${disk13} ${disk14} ${disk15} raidz2 ${disk16} ${disk17} ${disk18} ${disk19}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo " ${disk7} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk8} ONLINE 0 0 0"
+ echo " ${disk9} ONLINE 0 0 0"
+ echo " ${disk10} ONLINE 0 0 0"
+ echo " ${disk11} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk12} ONLINE 0 0 0"
+ echo " ${disk13} ONLINE 0 0 0"
+ echo " ${disk14} ONLINE 0 0 0"
+ echo " ${disk15} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk16} ONLINE 0 0 0"
+ echo " ${disk17} ONLINE 0 0 0"
+ echo " ${disk18} ONLINE 0 0 0"
+ echo " ${disk19} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/add/spare.t b/tools/regression/zfs/zpool/add/spare.t
new file mode 100644
index 000000000000..ddefd55a0ea7
--- /dev/null
+++ b/tools/regression/zfs/zpool/add/spare.t
@@ -0,0 +1,136 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..31"
+
+disks_create 6
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_ok ${ZPOOL} add ${name0} spare ${disk1}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " spares"
+ echo " ${disk1} AVAIL"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} add ${name0} spare ${disk2} ${disk3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " spares"
+ echo " ${disk2} AVAIL"
+ echo " ${disk3} AVAIL"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} add ${name0} spare ${disk3} ${disk4}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " spares"
+ echo " ${disk3} AVAIL"
+ echo " ${disk4} AVAIL"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} add ${name0} spare ${disk4} ${disk5}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " spares"
+ echo " ${disk4} AVAIL"
+ echo " ${disk5} AVAIL"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} spare ${disk1}
+expect_ok ${ZPOOL} add ${name0} spare ${disk2} ${disk3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " spares"
+ echo " ${disk1} AVAIL"
+ echo " ${disk2} AVAIL"
+ echo " ${disk3} AVAIL"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_ok ${ZPOOL} add ${name0} spare ${disk1} ${disk2}
+expect_ok ${ZPOOL} add ${name0} spare ${disk3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " spares"
+ echo " ${disk1} AVAIL"
+ echo " ${disk2} AVAIL"
+ echo " ${disk3} AVAIL"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/attach/log.t b/tools/regression/zfs/zpool/attach/log.t
new file mode 100644
index 000000000000..8ef6fd972b8a
--- /dev/null
+++ b/tools/regression/zfs/zpool/attach/log.t
@@ -0,0 +1,231 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..34"
+
+disks_create 6
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log ${disk1}
+expect_ok ${ZPOOL} attach ${name0} ${disk1} ${disk2}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} attach ${name0} ${disk1} ${disk3}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} attach ${name0} ${disk3} ${disk4}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} detach ${name0} ${disk1}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} detach ${name0} ${disk3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} detach ${name0} ${disk4}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_fl ${ZPOOL} detach ${name0} ${disk2}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log ${disk1}
+expect_ok ${ZPOOL} attach ${name0} ${disk1} ${disk2}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log ${disk1} ${disk2}
+expect_ok ${ZPOOL} attach ${name0} ${disk1} ${disk3}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} attach ${name0} ${disk2} ${disk4}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} attach ${name0} ${disk1} ${disk5}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/attach/mirror.t b/tools/regression/zfs/zpool/attach/mirror.t
new file mode 100644
index 000000000000..ce7b8d57d5f9
--- /dev/null
+++ b/tools/regression/zfs/zpool/attach/mirror.t
@@ -0,0 +1,207 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..34"
+
+disks_create 5
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_ok ${ZPOOL} attach ${name0} ${disk0} ${disk1}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered"
+ echo " ${disk1} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} attach ${name0} ${disk0} ${disk2}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered"
+ echo " ${disk1} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered"
+ echo " ${disk2} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} attach ${name0} ${disk2} ${disk3}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered"
+ echo " ${disk1} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered"
+ echo " ${disk2} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered"
+ echo " ${disk3} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} detach ${name0} ${disk0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered"
+ echo " ${disk2} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered"
+ echo " ${disk3} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} detach ${name0} ${disk2}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered"
+ echo " ${disk3} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} detach ${name0} ${disk3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_fl ${ZPOOL} detach ${name0} ${disk1}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_ok ${ZPOOL} attach ${name0} ${disk0} ${disk1}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered"
+ echo " ${disk1} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} ${disk1}
+expect_ok ${ZPOOL} attach ${name0} ${disk0} ${disk2}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered"
+ echo " ${disk2} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} attach ${name0} ${disk1} ${disk3}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered"
+ echo " ${disk3} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} attach ${name0} ${disk0} ${disk4}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered"
+ echo " ${disk2} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered"
+ echo " ${disk4} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/attach/option-f_inuse.t b/tools/regression/zfs/zpool/attach/option-f_inuse.t
new file mode 100644
index 000000000000..f99e196df3e1
--- /dev/null
+++ b/tools/regression/zfs/zpool/attach/option-f_inuse.t
@@ -0,0 +1,669 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..141"
+
+disks_create 11
+names_create 2
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} create ${name1} ${disk1}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of exported pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} attach ${name1} ${disk1} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} attach -f ${name1} ${disk1} ${disk0}
+wait_for_resilver ${name1}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk0} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} create ${name1} mirror ${disk1} ${disk2}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of exported pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} attach ${name1} ${disk1} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} attach -f ${name1} ${disk1} ${disk0}
+wait_for_resilver ${name1}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk2} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk0} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+
+expect_ok ${ZPOOL} create ${name0} ${disk1} log mirror ${disk2} ${disk0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} create ${name1} ${disk3} log ${disk4}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of exported pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} attach ${name1} ${disk4} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} attach -f ${name1} ${disk4} ${disk0}
+wait_for_resilver ${name1}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk0} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} import ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk1} log mirror ${disk2} ${disk0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} create ${name1} ${disk3} log mirror ${disk4} ${disk5}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of exported pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} attach ${name1} ${disk2} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} attach -f ${name1} ${disk4} ${disk0}
+wait_for_resilver ${name1}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk5} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk0} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} import ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk1} cache ${disk0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} create ${name1} ${disk2}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of exported pool '${name0}'"
+)`
+add_msg="# TODO It shouldn't be possible to use offlined cache vdevs."
+expect "${exp}" ${ZPOOL} attach ${name1} ${disk2} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} attach -f ${name1} ${disk2} ${disk0}
+add_msg=""
+wait_for_resilver ${name1}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk0} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} import ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} create ${name1} ${disk2}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of potentially active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} attach ${name1} ${disk2} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} attach -f ${name1} ${disk2} ${disk0}
+wait_for_resilver ${name1}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk0} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} import ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} create ${name1} mirror ${disk2} ${disk3}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of potentially active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} attach ${name1} ${disk2} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} attach -f ${name1} ${disk2} ${disk0}
+wait_for_resilver ${name1}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk3} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk0} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} import ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk1} log mirror ${disk2} ${disk0}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} create ${name1} ${disk3} log ${disk4}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of potentially active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} attach ${name1} ${disk4} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} attach -f ${name1} ${disk4} ${disk0}
+wait_for_resilver ${name1}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk0} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} import ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk1} log mirror ${disk2} ${disk0}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} create ${name1} ${disk3} log mirror ${disk4} ${disk5}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of potentially active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} attach ${name1} ${disk2} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} attach -f ${name1} ${disk4} ${disk0}
+wait_for_resilver ${name1}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk5} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk0} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} import ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk1} cache ${disk0}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} create ${name1} ${disk2}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of potentially active pool '${name0}'"
+)`
+add_msg="# TODO It shouldn't be possible to use offlined cache vdevs."
+expect "${exp}" ${ZPOOL} attach ${name1} ${disk2} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} attach -f ${name1} ${disk2} ${disk0}
+add_msg=""
+wait_for_resilver ${name1}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk0} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} import ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_ok ${ZPOOL} create ${name1} ${disk1}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} attach ${name1} ${disk2} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+exp=`(
+ echo "invalid vdev specification"
+ echo "the following errors must be manually repaired:"
+ echo "${fdisk0} is part of active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} attach -f ${name1} ${disk2} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} create ${name1} mirror ${disk2} ${disk3}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} attach ${name1} ${disk2} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+exp=`(
+ echo "invalid vdev specification"
+ echo "the following errors must be manually repaired:"
+ echo "${fdisk0} is part of active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} attach -f ${name1} ${disk2} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk1} log ${disk0}
+expect_ok ${ZPOOL} create ${name1} ${disk2} log ${disk3}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} attach ${name1} ${disk3} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+exp=`(
+ echo "invalid vdev specification"
+ echo "the following errors must be manually repaired:"
+ echo "${fdisk0} is part of active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} attach -f ${name1} ${disk3} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk1} log mirror ${disk2} ${disk0}
+expect_ok ${ZPOOL} create ${name1} ${disk3} log mirror ${disk4} ${disk5}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} attach ${name1} ${disk2} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+exp=`(
+ echo "invalid vdev specification"
+ echo "the following errors must be manually repaired:"
+ echo "${fdisk0} is part of active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} attach -f ${name1} ${disk4} ${disk0}
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk1} cache ${disk0}
+expect_ok ${ZPOOL} create ${name1} ${disk2}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of active pool '${name0}'"
+)`
+add_msg="# TODO It shouldn't be possible to use offlined cache vdevs."
+expect "${exp}" ${ZPOOL} attach ${name1} ${disk2} ${disk0}
+add_msg=""
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+add_msg="# TODO It shouldn't be possible to use offlined cache vdevs."
+exp=`(
+ echo "invalid vdev specification"
+ echo "the following errors must be manually repaired:"
+ echo "${fdisk0} is part of active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} attach -f ${name1} ${disk2} ${disk0}
+add_msg=""
+exp=`(
+ echo " pool: ${name1}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} destroy ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/create/already_exists.t b/tools/regression/zfs/zpool/create/already_exists.t
new file mode 100644
index 000000000000..7bb098b54de2
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/already_exists.t
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..5"
+
+disks_create 2
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_fl ${ZPOOL} create ${name0} ${disk1}
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/create/automount.t b/tools/regression/zfs/zpool/create/automount.t
new file mode 100644
index 000000000000..12fae937c41c
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/automount.t
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..5"
+
+disks_create 1
+names_create 1
+
+expect_fl is_mountpoint /${name0}
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+if [ -z "${no_mountpoint}" ]; then
+ expect_ok is_mountpoint /${name0}
+else
+ expect_fl is_mountpoint /${name0}
+fi
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl is_mountpoint /${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/create/cache.t b/tools/regression/zfs/zpool/create/cache.t
new file mode 100644
index 000000000000..b95fccdc6603
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/cache.t
@@ -0,0 +1,125 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..35"
+
+disks_create 6
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} cache ${disk1}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " cache"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} cache ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " cache"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} cache ${disk2} ${disk3}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " cache"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2} cache ${disk3} ${disk4}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " cache"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3} cache ${disk4} ${disk5}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " cache"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/create/disks.t b/tools/regression/zfs/zpool/create/disks.t
new file mode 100644
index 000000000000..5b3513484d91
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/disks.t
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..14"
+
+disks_create 5
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} ${disk1} ${disk2} ${disk3} ${disk4}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/create/files.t b/tools/regression/zfs/zpool/create/files.t
new file mode 100644
index 000000000000..1a06689173ea
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/files.t
@@ -0,0 +1,188 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..59"
+
+files_create 5
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} ${file0}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${file0} ${file1} ${file2} ${file3} ${file4}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo " ${file2} ONLINE 0 0 0"
+ echo " ${file3} ONLINE 0 0 0"
+ echo " ${file4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${file0} ${file1}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${file0} ${file1} ${file2}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo " ${file2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${file0} ${file1} ${file2} ${file3}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo " ${file2} ONLINE 0 0 0"
+ echo " ${file3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${file0} ${file1} spare ${file2} ${file3}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo " spares"
+ echo " ${file2} AVAIL "
+ echo " ${file3} AVAIL "
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${file0} ${file1} log ${file2} ${file3}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " ${file2} ONLINE 0 0 0"
+ echo " ${file3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${file0} ${file1} log mirror ${file2} ${file3}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${file2} ONLINE 0 0 0"
+ echo " ${file3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} mirror ${file0} ${file1} cache ${file2} ${file3}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+files_destroy
diff --git a/tools/regression/zfs/zpool/create/log.t b/tools/regression/zfs/zpool/create/log.t
new file mode 100644
index 000000000000..ff09667aa18a
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/log.t
@@ -0,0 +1,201 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..56"
+
+disks_create 7
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log ${disk1}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} log ${disk2}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} log mirror ${disk2} ${disk3} ${disk4}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz ${disk0} ${disk1} ${disk2} log ${disk3}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2} log mirror ${disk3} ${disk4} ${disk5}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3} log ${disk4}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3} log mirror ${disk4} ${disk5} ${disk6}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/create/mirror.t b/tools/regression/zfs/zpool/create/mirror.t
new file mode 100644
index 000000000000..a5b93fad52a5
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/mirror.t
@@ -0,0 +1,82 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..22"
+
+disks_create 6
+names_create 1
+
+expect_fl ${ZPOOL} create ${name0} mirror ${disk0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} ${disk2} ${disk3} ${disk4}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} mirror ${disk2} ${disk3} mirror ${disk4} ${disk5}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/create/option-R.t b/tools/regression/zfs/zpool/create/option-R.t
new file mode 100644
index 000000000000..cf20d0f12882
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/option-R.t
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..9"
+
+disks_create 1
+names_create 2
+
+expect_fl is_mountpoint /${name0}
+expect_fl is_mountpoint /${name1}
+expect_ok ${ZPOOL} create -R /${name1} ${name0} ${disk0}
+exp=`(
+ echo "NAME PROPERTY VALUE SOURCE"
+ echo "${name0} altroot /${name1} local"
+)`
+expect "${exp}" ${ZPOOL} get altroot ${name0}
+expect_fl is_mountpoint /${name0}
+if [ -z "${no_mountpoint}" ]; then
+ expect_ok is_mountpoint /${name1}
+else
+ expect_fl is_mountpoint /${name1}
+fi
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl is_mountpoint /${name0}
+expect_fl is_mountpoint /${name1}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/create/option-f_inuse.t b/tools/regression/zfs/zpool/create/option-f_inuse.t
new file mode 100644
index 000000000000..b9905fb86b2c
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/option-f_inuse.t
@@ -0,0 +1,296 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..146"
+
+disks_create 7
+names_create 2
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_ok ${ZPOOL} export ${name0}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of exported pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} create ${name1} ${disk0}
+expect_fl ${ZPOOL} status -x ${name1}
+expect_ok ${ZPOOL} create -f ${name1} ${disk0}
+expect_ok ${ZPOOL} status -x ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} export ${name0}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of exported pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} create ${name1} mirror ${disk0} ${disk1}
+expect_fl ${ZPOOL} status -x ${name1}
+expect_ok ${ZPOOL} create -f ${name1} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} status -x ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} export ${name0}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of exported pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} create ${name1} raidz1 ${disk0} ${disk1} ${disk2}
+expect_fl ${ZPOOL} status -x ${name1}
+expect_ok ${ZPOOL} create -f ${name1} raidz1 ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} status -x ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} export ${name0}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of exported pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} create ${name1} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_fl ${ZPOOL} status -x ${name1}
+expect_ok ${ZPOOL} create -f ${name1} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} status -x ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log ${disk1}
+expect_ok ${ZPOOL} export ${name0}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of exported pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} create ${name1} ${disk0} log ${disk1}
+expect_fl ${ZPOOL} status -x ${name1}
+expect_ok ${ZPOOL} create -f ${name1} ${disk0} log ${disk1}
+expect_ok ${ZPOOL} status -x ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2}
+expect_ok ${ZPOOL} export ${name0}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of exported pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} create ${name1} ${disk0} log mirror ${disk1} ${disk2}
+expect_fl ${ZPOOL} status -x ${name1}
+expect_ok ${ZPOOL} create -f ${name1} ${disk0} log mirror ${disk1} ${disk2}
+expect_ok ${ZPOOL} status -x ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} cache ${disk1}
+expect_ok ${ZPOOL} export ${name0}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of exported pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} create ${name1} ${disk0} cache ${disk1}
+expect_fl ${ZPOOL} status -x ${name1}
+expect_ok ${ZPOOL} create -f ${name1} ${disk0} cache ${disk1}
+expect_ok ${ZPOOL} status -x ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} offline ${name0} ${disk1}
+expect_ok ${ZPOOL} export ${name0}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk1} is part of potentially active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} create ${name1} mirror ${disk1} ${disk2}
+expect_fl ${ZPOOL} status -x ${name1}
+expect_ok ${ZPOOL} create -f ${name1} mirror ${disk1} ${disk2}
+expect_ok ${ZPOOL} status -x ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} import ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} offline ${name0} ${disk2}
+expect_ok ${ZPOOL} export ${name0}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk2} is part of potentially active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} create ${name1} raidz1 ${disk2} ${disk3} ${disk4}
+expect_fl ${ZPOOL} status -x ${name1}
+expect_ok ${ZPOOL} create -f ${name1} raidz1 ${disk2} ${disk3} ${disk4}
+expect_ok ${ZPOOL} status -x ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} import ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} offline ${name0} ${disk3}
+expect_ok ${ZPOOL} export ${name0}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk3} is part of potentially active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} create ${name1} raidz2 ${disk3} ${disk4} ${disk5} ${disk6}
+expect_fl ${ZPOOL} status -x ${name1}
+expect_ok ${ZPOOL} create -f ${name1} raidz2 ${disk3} ${disk4} ${disk5} ${disk6}
+expect_ok ${ZPOOL} status -x ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} import ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2}
+expect_ok ${ZPOOL} offline ${name0} ${disk2}
+expect_ok ${ZPOOL} export ${name0}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk2} is part of potentially active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} create ${name1} ${disk3} log mirror ${disk2} ${disk4}
+expect_fl ${ZPOOL} status -x ${name1}
+expect_ok ${ZPOOL} create -f ${name1} ${disk3} log mirror ${disk2} ${disk4}
+expect_ok ${ZPOOL} status -x ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} import ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} cache ${disk1}
+expect_ok ${ZPOOL} offline ${name0} ${disk1}
+expect_ok ${ZPOOL} export ${name0}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk1} is part of potentially active pool '${name0}'"
+)`
+add_msg="# TODO It shouldn't be possible to use offlined cache vdev."
+expect "${exp}" ${ZPOOL} create ${name1} ${disk2} cache ${disk1}
+expect_fl ${ZPOOL} status -x ${name1}
+expect_ok ${ZPOOL} create -f ${name1} ${disk2} cache ${disk1}
+add_msg=""
+expect_ok ${ZPOOL} status -x ${name1}
+expect_ok ${ZPOOL} destroy ${name1}
+expect_ok ${ZPOOL} import ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} offline ${name0} ${disk1}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk1} is part of active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} create ${name1} mirror ${disk1} ${disk2}
+expect_fl ${ZPOOL} status -x ${name1}
+exp=`(
+ echo "invalid vdev specification"
+ echo "the following errors must be manually repaired:"
+ echo "${fdisk1} is part of active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} create -f ${name1} mirror ${disk1} ${disk2}
+expect_fl ${ZPOOL} status -x ${name1}
+expect_ok ${ZPOOL} online ${name0} ${disk1}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} offline ${name0} ${disk2}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk2} is part of active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} create ${name1} raidz1 ${disk2} ${disk3} ${disk4}
+expect_fl ${ZPOOL} status -x ${name1}
+exp=`(
+ echo "invalid vdev specification"
+ echo "the following errors must be manually repaired:"
+ echo "${fdisk2} is part of active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} create -f ${name1} raidz1 ${disk2} ${disk3} ${disk4}
+expect_fl ${ZPOOL} status -x ${name1}
+expect_ok ${ZPOOL} online ${name0} ${disk2}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} offline ${name0} ${disk3}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk3} is part of active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} create ${name1} raidz2 ${disk3} ${disk4} ${disk5} ${disk6}
+expect_fl ${ZPOOL} status -x ${name1}
+exp=`(
+ echo "invalid vdev specification"
+ echo "the following errors must be manually repaired:"
+ echo "${fdisk3} is part of active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} create -f ${name1} raidz2 ${disk3} ${disk4} ${disk5} ${disk6}
+expect_fl ${ZPOOL} status -x ${name1}
+expect_ok ${ZPOOL} online ${name0} ${disk3}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2}
+expect_ok ${ZPOOL} offline ${name0} ${disk2}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk2} is part of active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} create ${name1} ${disk3} log mirror ${disk2} ${disk4}
+expect_fl ${ZPOOL} status -x ${name1}
+exp=`(
+ echo "invalid vdev specification"
+ echo "the following errors must be manually repaired:"
+ echo "${fdisk2} is part of active pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} create -f ${name1} ${disk3} log mirror ${disk2} ${disk4}
+expect_fl ${ZPOOL} status -x ${name1}
+expect_ok ${ZPOOL} online ${name0} ${disk2}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} cache ${disk1}
+expect_ok ${ZPOOL} offline ${name0} ${disk1}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk1} is part of active pool '${name0}'"
+)`
+add_msg="# TODO It reports that ${fdisk1} is part of unknown pool."
+expect "${exp}" ${ZPOOL} create ${name1} ${disk2} cache ${disk1}
+add_msg=""
+expect_fl ${ZPOOL} status -x ${name1}
+exp=`(
+ echo "invalid vdev specification"
+ echo "the following errors must be manually repaired:"
+ echo "${fdisk1} is part of active pool '${name0}'"
+)`
+add_msg="# TODO It reports that ${fdisk1} is used twice."
+expect "${exp}" ${ZPOOL} create -f ${name1} ${disk2} cache ${disk1}
+add_msg=""
+expect_fl ${ZPOOL} status -x ${name1}
+expect_ok ${ZPOOL} online ${name0} ${disk1}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_ok ${ZPOOL} export ${name0}
+exp=`(
+ echo "invalid vdev specification"
+ echo "use '-f' to override the following errors:"
+ echo "${fdisk0} is part of exported pool '${name0}'"
+)`
+expect "${exp}" ${ZPOOL} create ${name0} ${disk0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_ok ${ZPOOL} create -f ${name0} ${disk0}
+expect_ok ${ZPOOL} status -x ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/create/option-f_replication_level_mismatch_0.t b/tools/regression/zfs/zpool/create/option-f_replication_level_mismatch_0.t
new file mode 100644
index 000000000000..fcaf7a9c55a6
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/option-f_replication_level_mismatch_0.t
@@ -0,0 +1,199 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..70"
+
+disks_create 6
+names_create 1
+
+expect_fl ${ZPOOL} create ${name0} ${disk0} mirror ${disk1} ${disk2}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} ${disk0} mirror ${disk1} ${disk2}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} ${disk0} ${disk1} mirror ${disk2} ${disk3}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} ${disk0} ${disk1} mirror ${disk2} ${disk3}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} ${disk0} raidz ${disk1} ${disk2} ${disk3}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} ${disk0} raidz ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} ${disk0} ${disk1} raidz1 ${disk2} ${disk3} ${disk4}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} ${disk0} ${disk1} raidz1 ${disk2} ${disk3} ${disk4}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} ${disk0} raidz2 ${disk1} ${disk2} ${disk3} ${disk4}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} ${disk0} raidz2 ${disk1} ${disk2} ${disk3} ${disk4}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} ${disk0} ${disk1} raidz2 ${disk2} ${disk3} ${disk4} ${disk5}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} ${disk0} ${disk1} raidz2 ${disk2} ${disk3} ${disk4} ${disk5}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+add_msg="# TODO Sun CR 6726091, Lustre bug 16873"
+expect_fl ${ZPOOL} create ${name0} ${disk0} log ${disk1} mirror ${disk2} ${disk3}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+add_msg=""
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} ${disk0} log ${disk1} mirror ${disk2} ${disk3}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/create/option-f_replication_level_mismatch_1.t b/tools/regression/zfs/zpool/create/option-f_replication_level_mismatch_1.t
new file mode 100644
index 000000000000..92f4bbc89f89
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/option-f_replication_level_mismatch_1.t
@@ -0,0 +1,539 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..180"
+
+disks_create 9
+names_create 1
+
+expect_fl ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} mirror ${disk2} ${disk3} ${disk4}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} mirror ${disk0} ${disk1} mirror ${disk2} ${disk3} ${disk4}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} ${disk2} mirror ${disk3} ${disk4}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} mirror ${disk0} ${disk1} ${disk2} mirror ${disk3} ${disk4}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} raidz ${disk0} ${disk1} ${disk2} raidz ${disk3} ${disk4} ${disk5} ${disk6}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} raidz ${disk0} ${disk1} ${disk2} raidz ${disk3} ${disk4} ${disk5} ${disk6}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} raidz ${disk0} ${disk1} ${disk2} ${disk3} raidz ${disk4} ${disk5} ${disk6}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} raidz ${disk0} ${disk1} ${disk2} ${disk3} raidz ${disk4} ${disk5} ${disk6}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3} raidz2 ${disk4} ${disk5} ${disk6} ${disk7} ${disk8}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3} raidz2 ${disk4} ${disk5} ${disk6} ${disk7} ${disk8}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo " ${disk7} ONLINE 0 0 0"
+ echo " ${disk8} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3} ${disk4} raidz2 ${disk5} ${disk6} ${disk7} ${disk8}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3} ${disk4} raidz2 ${disk5} ${disk6} ${disk7} ${disk8}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo " ${disk7} ONLINE 0 0 0"
+ echo " ${disk8} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} raidz ${disk2} ${disk3}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} mirror ${disk0} ${disk1} raidz ${disk2} ${disk3}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} raidz ${disk0} ${disk1} mirror ${disk2} ${disk3}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} raidz ${disk0} ${disk1} mirror ${disk2} ${disk3}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} ${disk2} raidz ${disk3} ${disk4}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} mirror ${disk0} ${disk1} ${disk2} raidz ${disk3} ${disk4}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} raidz ${disk2} ${disk3} ${disk4}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} mirror ${disk0} ${disk1} raidz ${disk2} ${disk3} ${disk4}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} raidz2 ${disk2} ${disk3} ${disk4}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} mirror ${disk0} ${disk1} raidz2 ${disk2} ${disk3} ${disk4}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} ${disk2} raidz2 ${disk3} ${disk4} ${disk5}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} mirror ${disk0} ${disk1} ${disk2} raidz2 ${disk3} ${disk4} ${disk5}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} ${disk2} ${disk3} raidz2 ${disk4} ${disk5} ${disk6}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} mirror ${disk0} ${disk1} ${disk2} ${disk3} raidz2 ${disk4} ${disk5} ${disk6}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} raidz2 ${disk2} ${disk3} ${disk4}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} raidz1 ${disk0} ${disk1} raidz2 ${disk2} ${disk3} ${disk4}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${dik2} raidz2 ${disk3} ${disk4} ${disk5}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} raidz1 ${disk0} ${disk1} ${disk2} raidz2 ${disk3} ${disk4} ${disk5}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${dik2} ${disk3} raidz2 ${disk4} ${disk5} ${disk6}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} raidz1 ${disk0} ${disk1} ${disk2} ${disk3} raidz2 ${disk4} ${disk5} ${disk6}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+add_msg="# TODO Sun CR 6726091, Lustre bug 16873"
+expect_fl ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2} mirror ${disk3} ${disk4} ${disk5}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+add_msg=""
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} ${disk0} log mirror ${disk1} ${disk2} mirror ${disk3} ${disk4} ${disk5}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+add_msg="# TODO Sun CR 6726091, Lustre bug 16873"
+expect_fl ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2} ${disk3} mirror ${disk4} ${disk5}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+add_msg=""
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} ${disk0} log mirror ${disk1} ${disk2} ${disk3} mirror ${disk4} ${disk5}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/create/option-f_size_mismatch.t b/tools/regression/zfs/zpool/create/option-f_size_mismatch.t
new file mode 100644
index 000000000000..d0fda7af192e
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/option-f_size_mismatch.t
@@ -0,0 +1,255 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..104"
+
+disks_create 1 64M
+disks_create 4
+disks_create 3 64M
+files_create 1 64M
+files_create 4
+files_create 3 64M
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} ${disk1}
+expect_ok ${ZPOOL} status -x ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${file0} ${file1}
+expect_ok ${ZPOOL} status -x ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk1} ${disk2} mirror ${disk0} ${disk5}
+expect_ok ${ZPOOL} status -x ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${file1} ${file2} mirror ${file0} ${file5}
+expect_ok ${ZPOOL} status -x ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk1} ${disk2} ${disk3} raidz1 ${disk0} ${disk5} ${disk6}
+expect_ok ${ZPOOL} status -x ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${file1} ${file2} ${file3} raidz1 ${file0} ${file5} ${file6}
+expect_ok ${ZPOOL} status -x ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk1} ${disk2} ${disk3} ${disk4} raidz2 ${disk0} ${disk5} ${disk6} ${disk7}
+expect_ok ${ZPOOL} status -x ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${file1} ${file2} ${file3} ${file4} raidz2 ${file0} ${file5} ${file6} ${file7}
+expect_ok ${ZPOOL} status -x ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} mirror ${file0} ${file1}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} mirror ${file0} ${file1}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} raidz1 ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} raidz1 ${file0} ${file1} ${file2}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} raidz1 ${file0} ${file1} ${file2}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo " ${file2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} raidz2 ${file0} ${file1} ${file2} ${file3}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} raidz2 ${file0} ${file1} ${file2} ${file3}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo " ${file2} ONLINE 0 0 0"
+ echo " ${file3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+add_msg="# TODO Sun CR 6726091, Lustre bug 16873"
+expect_fl ${ZPOOL} create ${name0} ${disk1} log mirror ${disk0} ${disk2}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+add_msg=""
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} ${disk1} log mirror ${disk0} ${disk2}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+add_msg="# TODO Sun CR 6726091, Lustre bug 16873"
+expect_fl ${ZPOOL} create ${name0} ${file1} log mirror ${file0} ${file2}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+add_msg=""
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} ${file1} log mirror ${file0} ${file2}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+disks_destroy
+files_destroy
diff --git a/tools/regression/zfs/zpool/create/option-f_type_mismatch.t b/tools/regression/zfs/zpool/create/option-f_type_mismatch.t
new file mode 100644
index 000000000000..b0b69d935bd4
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/option-f_type_mismatch.t
@@ -0,0 +1,413 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..160"
+
+disks_create 6
+files_create 2
+names_create 1
+
+expect_fl ${ZPOOL} create ${name0} ${disk0} ${file0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} ${disk0} ${file0}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} ${file0} ${disk0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} ${file0} ${disk0}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} mirror ${disk0} ${file0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} mirror ${disk0} ${file0}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} mirror ${file0} ${disk0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} mirror ${file0} ${disk0}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} mirror ${disk0} ${file0} ${file1}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} mirror ${disk0} ${file0} ${file1}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} mirror ${file0} ${disk0} ${disk1}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} mirror ${file0} ${disk0} ${disk1}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} raidz1 ${disk0} ${file0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} raidz1 ${disk0} ${file0}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} raidz1 ${file0} ${disk0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} raidz1 ${file0} ${disk0}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} raidz1 ${disk0} ${file0} ${file1}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} raidz1 ${disk0} ${file0} ${file1}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} raidz1 ${file0} ${disk0} ${disk1}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} raidz1 ${file0} ${disk0} ${disk1}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} raidz2 ${disk0} ${file0} ${file1}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} raidz2 ${disk0} ${file0} ${file1}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} raidz2 ${file0} ${disk0} ${disk1}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} raidz2 ${file0} ${disk0} ${disk1}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${file0} ${file1}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} raidz2 ${disk0} ${disk1} ${file0} ${file1}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create ${name0} raidz2 ${file0} ${disk0} ${file1} ${disk1}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} raidz2 ${file0} ${disk0} ${file1} ${disk1}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+add_msg="# TODO Sun CR 6726091, Lustre bug 16873"
+expect_fl ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${file0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+add_msg=""
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} ${disk0} log mirror ${disk1} ${file0}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+add_msg="# TODO Sun CR 6726091, Lustre bug 16873"
+expect_fl ${ZPOOL} create ${name0} ${file0} log mirror ${file1} ${disk0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+add_msg=""
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} ${file0} log mirror ${file1} ${disk0}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${file1} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+disks_destroy
+files_destroy
diff --git a/tools/regression/zfs/zpool/create/option-m.t b/tools/regression/zfs/zpool/create/option-m.t
new file mode 100644
index 000000000000..d5ed832e6f4d
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/option-m.t
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..28"
+
+disks_create 1
+names_create 2
+
+expect_fl is_mountpoint /${name0}
+expect_fl is_mountpoint /${name1}
+expect_ok ${ZPOOL} create -m /${name1} ${name0} ${disk0}
+exp=`(
+ echo "NAME PROPERTY VALUE SOURCE"
+ echo "${name0} altroot - default"
+)`
+expect "${exp}" ${ZPOOL} get altroot ${name0}
+expect_fl is_mountpoint /${name0}
+if [ -z "${no_mountpoint}" ]; then
+ expect_ok is_mountpoint /${name1}
+else
+ expect_fl is_mountpoint /${name1}
+fi
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl is_mountpoint /${name0}
+expect_fl is_mountpoint /${name1}
+expect_ok rmdir /${name1}
+
+expect_ok mkdir /${name1}
+expect_ok ${ZPOOL} create -m legacy ${name0} ${disk0}
+expect_fl is_mountpoint /${name0}
+expect_ok mount ${mount_t_flag} zfs ${name0} /${name1}
+if [ -z "${no_mountpoint}" ]; then
+ expect_ok is_mountpoint /${name1}
+else
+ expect_fl is_mountpoint /${name1}
+fi
+expect_ok umount /${name1}
+expect_fl is_mountpoint /${name1}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_ok rmdir /${name1}
+
+expect_ok mkdir /${name1}
+expect_ok ${ZPOOL} create -m none ${name0} ${disk0}
+expect_fl is_mountpoint /${name0}
+expect_ok mount ${mount_t_flag} zfs ${name0} /${name1}
+if [ -z "${no_mountpoint}" ]; then
+ expect_ok is_mountpoint /${name1}
+else
+ expect_fl is_mountpoint /${name1}
+fi
+expect_ok umount /${name1}
+expect_fl is_mountpoint /${name1}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_ok rmdir /${name1}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/create/option-n.t b/tools/regression/zfs/zpool/create/option-n.t
new file mode 100644
index 000000000000..8fddf383488c
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/option-n.t
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..5"
+
+disks_create 1
+names_create 1
+
+expect_fl is_mountpoint /${name0}
+exp=`(
+ echo "would create '${name0}' with the following layout:"
+ echo " ${name0}"
+ echo " ${disk0}"
+)`
+expect "${exp}" ${ZPOOL} create -n ${name0} ${disk0}
+expect_fl is_mountpoint /${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/create/option-o.t b/tools/regression/zfs/zpool/create/option-o.t
new file mode 100644
index 000000000000..6278b37d9134
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/option-o.t
@@ -0,0 +1,106 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..44"
+
+disks_create 1
+names_create 2
+
+expect_fl ${ZPOOL} create -o size=96M ${name0} ${disk0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create -o used=0 ${name0} ${disk0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create -o available=96M ${name0} ${disk0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create -o capacity=0% ${name0} ${disk0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl is_mountpoint /${name0}
+expect_fl is_mountpoint /${name1}
+expect_ok ${ZPOOL} create -o altroot=/${name1} ${name0} ${disk0}
+exp=`(
+ echo "NAME PROPERTY VALUE SOURCE"
+ echo "${name0} altroot /${name1} local"
+)`
+expect "${exp}" ${ZPOOL} get altroot ${name0}
+expect_fl is_mountpoint /${name0}
+if [ -z "${no_mountpoint}" ]; then
+ expect_ok is_mountpoint /${name1}
+else
+ expect_fl is_mountpoint /${name1}
+fi
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl is_mountpoint /${name0}
+expect_fl is_mountpoint /${name1}
+
+expect_fl ${ZPOOL} create -o health=ONLINE ${name0} ${disk0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create -o guid=13949667482126165574 ${name0} ${disk0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create -o version=9 ${name0} ${disk0}
+exp=`(
+ echo "NAME PROPERTY VALUE SOURCE"
+ echo "${name0} version 9 local"
+)`
+expect "${exp}" ${ZPOOL} get version ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_fl ${ZPOOL} create -o bootfs=${name0}/root ${name0} ${disk0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create -o delegation=off ${name0} ${disk0}
+exp=`(
+ echo "NAME PROPERTY VALUE SOURCE"
+ echo "${name0} delegation off local"
+)`
+expect "${exp}" ${ZPOOL} get delegation ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create -o autoreplace=on ${name0} ${disk0}
+exp=`(
+ echo "NAME PROPERTY VALUE SOURCE"
+ echo "${name0} autoreplace on local"
+)`
+expect "${exp}" ${ZPOOL} get autoreplace ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create -o cachefile=none ${name0} ${disk0}
+exp=`(
+ echo "NAME PROPERTY VALUE SOURCE"
+ echo "${name0} cachefile none local"
+)`
+expect "${exp}" ${ZPOOL} get cachefile ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create -o cachefile=/tmp/${name1} ${name0} ${disk0}
+exp=`(
+ echo "NAME PROPERTY VALUE SOURCE"
+ echo "${name0} cachefile /tmp/${name1} local"
+)`
+expect "${exp}" ${ZPOOL} get cachefile ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create -o failmode=continue ${name0} ${disk0}
+exp=`(
+ echo "NAME PROPERTY VALUE SOURCE"
+ echo "${name0} failmode continue local"
+)`
+expect "${exp}" ${ZPOOL} get failmode ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create -o failmode=panic ${name0} ${disk0}
+exp=`(
+ echo "NAME PROPERTY VALUE SOURCE"
+ echo "${name0} failmode panic local"
+)`
+expect "${exp}" ${ZPOOL} get failmode ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/create/raidz1.t b/tools/regression/zfs/zpool/create/raidz1.t
new file mode 100644
index 000000000000..7aa684c23339
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/raidz1.t
@@ -0,0 +1,128 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..37"
+
+disks_create 9
+names_create 1
+
+expect_fl ${ZPOOL} create ${name0} raidz ${disk0}
+expect_fl ${ZPOOL} create ${name0} raidz1 ${disk0}
+
+expect_ok ${ZPOOL} create ${name0} raidz ${disk0} ${disk1}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2} ${disk3} ${disk4}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2} raidz ${disk3} ${disk4} ${disk5} raidz1 ${disk6} ${disk7} ${disk8}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo " ${disk7} ONLINE 0 0 0"
+ echo " ${disk8} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/create/raidz2.t b/tools/regression/zfs/zpool/create/raidz2.t
new file mode 100644
index 000000000000..ad6c28b6684c
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/raidz2.t
@@ -0,0 +1,90 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..23"
+
+disks_create 12
+names_create 1
+
+expect_fl ${ZPOOL} create ${name0} raidz2 ${disk0}
+expect_fl ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3} ${disk4}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3} raidz2 ${disk4} ${disk5} ${disk6} ${disk7} raidz2 ${disk8} ${disk9} ${disk10} ${disk11}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo " ${disk7} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk8} ONLINE 0 0 0"
+ echo " ${disk9} ONLINE 0 0 0"
+ echo " ${disk10} ONLINE 0 0 0"
+ echo " ${disk11} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/create/spare.t b/tools/regression/zfs/zpool/create/spare.t
new file mode 100644
index 000000000000..b87de5856172
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/spare.t
@@ -0,0 +1,103 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..28"
+
+disks_create 6
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} spare ${disk1}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " spares"
+ echo " ${disk1} AVAIL"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} spare ${disk2} ${disk3}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " spares"
+ echo " ${disk2} AVAIL"
+ echo " ${disk3} AVAIL"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz ${disk0} ${disk1} ${disk2} spare ${disk3} ${disk4}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " spares"
+ echo " ${disk3} AVAIL"
+ echo " ${disk4} AVAIL"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3} spare ${disk4} ${disk5}
+expect_ok ${ZPOOL} status -x ${name0}
+expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " spares"
+ echo " ${disk4} AVAIL"
+ echo " ${disk5} AVAIL"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+expect_fl ${ZPOOL} destroy ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/offline/io.t b/tools/regression/zfs/zpool/offline/io.t
new file mode 100644
index 000000000000..d2fe640997dc
--- /dev/null
+++ b/tools/regression/zfs/zpool/offline/io.t
@@ -0,0 +1,84 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..31"
+
+disks_create 4 128M
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+sum0_before=`calcsum ${fdisk0}`
+sum1_before=`calcsum ${fdisk1}`
+${ZFS} snapshot ${name0}@test
+sum0_after=`calcsum ${fdisk0}`
+sum1_after=`calcsum ${fdisk1}`
+expect_ok test "${sum0_before}" = "${sum0_after}"
+expect_fl test "${sum1_before}" = "${sum1_after}"
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} mirror ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} offline ${name0} ${disk1}
+add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
+expect_ok ${ZPOOL} offline ${name0} ${disk3}
+add_msg=""
+sum0_before=`calcsum ${fdisk0}`
+sum1_before=`calcsum ${fdisk1}`
+sum2_before=`calcsum ${fdisk2}`
+sum3_before=`calcsum ${fdisk3}`
+${ZFS} snapshot ${name0}@test
+sum0_after=`calcsum ${fdisk0}`
+sum1_after=`calcsum ${fdisk1}`
+sum2_after=`calcsum ${fdisk2}`
+sum3_after=`calcsum ${fdisk3}`
+expect_fl test "${sum0_before}" = "${sum0_after}"
+expect_ok test "${sum1_before}" = "${sum1_after}"
+expect_fl test "${sum2_before}" = "${sum2_after}"
+add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
+expect_ok test "${sum3_before}" = "${sum3_after}"
+add_msg=""
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} raidz1 ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} offline ${name0} ${disk1}
+sum0_before=`calcsum ${fdisk0}`
+sum1_before=`calcsum ${fdisk1}`
+sum2_before=`calcsum ${fdisk2}`
+${ZFS} snapshot ${name0}@test
+sum0_after=`calcsum ${fdisk0}`
+sum1_after=`calcsum ${fdisk1}`
+sum2_after=`calcsum ${fdisk2}`
+expect_fl test "${sum0_before}" = "${sum0_after}"
+expect_ok test "${sum1_before}" = "${sum1_after}"
+expect_fl test "${sum2_before}" = "${sum2_after}"
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} offline ${name0} ${disk1}
+add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
+expect_ok ${ZPOOL} offline ${name0} ${disk3}
+add_msg=""
+sum0_before=`calcsum ${fdisk0}`
+sum1_before=`calcsum ${fdisk1}`
+sum2_before=`calcsum ${fdisk2}`
+sum3_before=`calcsum ${fdisk3}`
+${ZFS} snapshot ${name0}@test
+sum0_after=`calcsum ${fdisk0}`
+sum1_after=`calcsum ${fdisk1}`
+sum2_after=`calcsum ${fdisk2}`
+sum3_after=`calcsum ${fdisk3}`
+expect_fl test "${sum0_before}" = "${sum0_after}"
+expect_ok test "${sum1_before}" = "${sum1_after}"
+expect_fl test "${sum2_before}" = "${sum2_after}"
+add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
+expect_ok test "${sum3_before}" = "${sum3_after}"
+add_msg=""
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/offline/log.t b/tools/regression/zfs/zpool/offline/log.t
new file mode 100644
index 000000000000..f4d8fada03e8
--- /dev/null
+++ b/tools/regression/zfs/zpool/offline/log.t
@@ -0,0 +1,253 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..67"
+
+disks_create 7
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2}
+expect_ok ${ZPOOL} offline ${name0} ${disk1}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} online ${name0} ${disk1}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2}
+expect_ok ${ZPOOL} offline ${name0} ${disk2}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} OFFLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} online ${name0} ${disk2}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2}
+expect_ok ${ZPOOL} offline ${name0} ${disk1}
+expect_fl ${ZPOOL} offline ${name0} ${disk2}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} online ${name0} ${disk1}
+expect_ok ${ZPOOL} online ${name0} ${disk2}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2} mirror ${disk3} ${disk4}
+expect_ok ${ZPOOL} offline ${name0} ${disk1}
+expect_ok ${ZPOOL} offline ${name0} ${disk4}
+expect_fl ${ZPOOL} offline ${name0} ${disk2}
+expect_fl ${ZPOOL} offline ${name0} ${disk3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} OFFLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} online ${name0} ${disk1}
+expect_ok ${ZPOOL} online ${name0} ${disk4}
+expect_ok ${ZPOOL} online ${name0} ${disk2}
+expect_ok ${ZPOOL} online ${name0} ${disk3}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2} mirror ${disk3} ${disk4}
+expect_ok ${ZPOOL} offline ${name0} ${disk2} ${disk3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} OFFLINE 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk3} OFFLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} online ${name0} ${disk2}
+expect_ok ${ZPOOL} online ${name0} ${disk3}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} offline ${name0} ${disk1}
+expect_ok ${ZPOOL} offline ${name0} ${disk2}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} OFFLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} online ${name0} ${disk1}
+expect_ok ${ZPOOL} online ${name0} ${disk2}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2} ${disk3} mirror ${disk4} ${disk5} ${disk6}
+expect_ok ${ZPOOL} offline ${name0} ${disk1}
+expect_ok ${ZPOOL} offline ${name0} ${disk2}
+expect_ok ${ZPOOL} offline ${name0} ${disk4} ${disk6}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} OFFLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk4} OFFLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} OFFLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} online ${name0} ${disk1}
+expect_ok ${ZPOOL} online ${name0} ${disk2}
+expect_ok ${ZPOOL} online ${name0} ${disk4}
+expect_ok ${ZPOOL} online ${name0} ${disk6}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2} ${disk3} ${disk4} ${disk5}
+expect_ok ${ZPOOL} offline ${name0} ${disk1} ${disk3} ${disk4} ${disk5}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} OFFLINE 0 0 0"
+ echo " ${disk4} OFFLINE 0 0 0"
+ echo " ${disk5} OFFLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} online ${name0} ${disk1}
+expect_ok ${ZPOOL} online ${name0} ${disk3}
+expect_ok ${ZPOOL} online ${name0} ${disk4}
+expect_ok ${ZPOOL} online ${name0} ${disk5}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/offline/mirror.t b/tools/regression/zfs/zpool/offline/mirror.t
new file mode 100644
index 000000000000..2863b9cc2dcf
--- /dev/null
+++ b/tools/regression/zfs/zpool/offline/mirror.t
@@ -0,0 +1,223 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..47"
+
+disks_create 6
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create -f ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} offline ${name0} ${disk1}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create -f ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+expect_fl ${ZPOOL} offline ${name0} ${disk1}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create -f ${name0} mirror ${disk0} ${disk1} mirror ${disk2} ${disk3}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+expect_ok ${ZPOOL} offline ${name0} ${disk3}
+expect_fl ${ZPOOL} offline ${name0} ${disk1}
+expect_fl ${ZPOOL} offline ${name0} ${disk2}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} OFFLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create -f ${name0} mirror ${disk0} ${disk1} mirror ${disk2} ${disk3}
+expect_ok ${ZPOOL} offline ${name0} ${disk1} ${disk2}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk2} OFFLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create -f ${name0} mirror ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
+expect_ok ${ZPOOL} offline ${name0} ${disk1}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+add_msg=""
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create -f ${name0} mirror ${disk0} ${disk1} ${disk2} mirror ${disk3} ${disk4} ${disk5}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
+expect_ok ${ZPOOL} offline ${name0} ${disk1}
+expect_ok ${ZPOOL} offline ${name0} ${disk3} ${disk5}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk3} OFFLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} OFFLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+add_msg=""
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create -f ${name0} mirror ${disk0} ${disk1} ${disk2} ${disk3} ${disk4}
+add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
+expect_ok ${ZPOOL} offline ${name0} ${disk0} ${disk2} ${disk3} ${disk4}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} OFFLINE 0 0 0"
+ echo " ${disk3} OFFLINE 0 0 0"
+ echo " ${disk4} OFFLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+add_msg=""
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/offline/option-t.t b/tools/regression/zfs/zpool/offline/option-t.t
new file mode 100644
index 000000000000..652160dc2cff
--- /dev/null
+++ b/tools/regression/zfs/zpool/offline/option-t.t
@@ -0,0 +1,1109 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..219"
+
+disks_create 8
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} online ${name0} ${disk0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} offline -t ${name0} ${disk0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} ${disk2}
+add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
+expect_ok ${ZPOOL} offline ${name0} ${disk0} ${disk1}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+add_msg=""
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
+expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
+add_msg=""
+expect_ok ${ZPOOL} online ${name0} ${disk0}
+expect_ok ${ZPOOL} online ${name0} ${disk1}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} ${disk2}
+add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
+expect_ok ${ZPOOL} offline -t ${name0} ${disk0} ${disk1}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+add_msg=""
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
+expect_ok ${ZPOOL} offline -t ${name0} ${disk1}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+add_msg=""
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
+expect_ok ${ZPOOL} online ${name0} ${disk0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} mirror ${disk2} ${disk3}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+expect_ok ${ZPOOL} offline -t ${name0} ${disk3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} OFFLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
+expect_ok ${ZPOOL} online ${name0} ${disk0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz1 DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz1 DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
+expect_ok ${ZPOOL} online ${name0} ${disk0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} offline -t ${name0} ${disk0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz1 DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2} raidz1 ${disk3} ${disk4} ${disk5}
+expect_ok ${ZPOOL} offline ${name0} ${disk1}
+expect_ok ${ZPOOL} offline -t ${name0} ${disk5}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz1 DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " raidz1 DEGRADED 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} OFFLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz1 DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
+expect_ok ${ZPOOL} online ${name0} ${disk1}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz2 DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz2 DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
+expect_ok ${ZPOOL} online ${name0} ${disk0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} offline -t ${name0} ${disk0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz2 DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
+expect_ok ${ZPOOL} offline ${name0} ${disk0} ${disk1}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz2 DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+add_msg=""
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz2 DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
+expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
+add_msg=""
+expect_ok ${ZPOOL} online ${name0} ${disk0}
+expect_ok ${ZPOOL} online ${name0} ${disk1}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
+expect_ok ${ZPOOL} offline -t ${name0} ${disk0} ${disk1}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz2 DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+add_msg=""
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
+expect_ok ${ZPOOL} offline -t ${name0} ${disk1}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz2 DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+add_msg=""
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz2 DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
+expect_ok ${ZPOOL} online ${name0} ${disk0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3} raidz2 ${disk4} ${disk5} ${disk6} ${disk7}
+expect_ok ${ZPOOL} offline ${name0} ${disk1}
+expect_ok ${ZPOOL} offline -t ${name0} ${disk6}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz2 DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " raidz2 DEGRADED 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} OFFLINE 0 0 0"
+ echo " ${disk7} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz2 DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo " ${disk7} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
+expect_ok ${ZPOOL} online ${name0} ${disk1}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2}
+expect_ok ${ZPOOL} offline ${name0} ${disk1}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} online ${name0} ${disk1}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2}
+expect_ok ${ZPOOL} offline -t ${name0} ${disk1}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} offline ${name0} ${disk1} ${disk2}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} OFFLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} OFFLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} online ${name0} ${disk1}
+expect_ok ${ZPOOL} online ${name0} ${disk2}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} offline -t ${name0} ${disk1} ${disk2}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} OFFLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} offline ${name0} ${disk1}
+expect_ok ${ZPOOL} offline -t ${name0} ${disk2}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} OFFLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} online ${name0} ${disk1}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2} mirror ${disk3} ${disk4}
+expect_ok ${ZPOOL} offline ${name0} ${disk1}
+expect_ok ${ZPOOL} offline -t ${name0} ${disk3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk3} OFFLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} online ${name0} ${disk1}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} cache ${disk1} ${disk2}
+expect_ok ${ZPOOL} offline ${name0} ${disk1}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " cache"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " cache"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} online ${name0} ${disk1}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} cache ${disk1} ${disk2}
+expect_ok ${ZPOOL} offline -t ${name0} ${disk1}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " cache"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " cache"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} cache ${disk1} ${disk2}
+expect_ok ${ZPOOL} offline ${name0} ${disk1}
+expect_ok ${ZPOOL} offline -t ${name0} ${disk2}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " cache"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} OFFLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} export ${name0}
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " cache"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} online ${name0} ${disk1}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/offline/raidz1.t b/tools/regression/zfs/zpool/offline/raidz1.t
new file mode 100644
index 000000000000..e377ed07d5c4
--- /dev/null
+++ b/tools/regression/zfs/zpool/offline/raidz1.t
@@ -0,0 +1,183 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..35"
+
+disks_create 5
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz1 DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create -f ${name0} raidz1 ${disk0} ${disk1}
+expect_ok ${ZPOOL} offline ${name0} ${disk1}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz1 DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create -f ${name0} raidz1 ${disk0} ${disk1}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+expect_fl ${ZPOOL} offline ${name0} ${disk1}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz1 DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create -f ${name0} raidz1 ${disk0} ${disk1} raidz1 ${disk2} ${disk3}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz1 DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect_ok ${ZPOOL} offline ${name0} ${disk3}
+expect_fl ${ZPOOL} offline ${name0} ${disk1}
+expect_fl ${ZPOOL} offline ${name0} ${disk2}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz1 DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " raidz1 DEGRADED 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} OFFLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create -f ${name0} raidz1 ${disk0} ${disk1} raidz1 ${disk2} ${disk3}
+expect_ok ${ZPOOL} offline ${name0} ${disk1} ${disk2}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz1 DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " raidz1 DEGRADED 0 0 0"
+ echo " ${disk2} OFFLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create -f ${name0} raidz1 ${disk0} ${disk1} ${disk2} ${disk3} ${disk4}
+expect_ok ${ZPOOL} offline ${name0} ${disk1}
+expect_fl ${ZPOOL} offline ${name0} ${disk3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz1 DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/offline/raidz2.t b/tools/regression/zfs/zpool/offline/raidz2.t
new file mode 100644
index 000000000000..cce59dbd02a2
--- /dev/null
+++ b/tools/regression/zfs/zpool/offline/raidz2.t
@@ -0,0 +1,201 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..33"
+
+disks_create 8
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz2 DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create -f ${name0} raidz2 ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} offline ${name0} ${disk1}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz2 DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create -f ${name0} raidz2 ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} offline ${name0} ${disk2}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz2 DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} OFFLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create -f ${name0} raidz2 ${disk0} ${disk1} ${disk2}
+add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
+expect_ok ${ZPOOL} offline ${name0} ${disk0} ${disk1}
+add_msg=""
+expect_fl ${ZPOOL} offline ${name0} ${disk2}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz2 DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
+expect "${exp}" ${ZPOOL} status ${name0}
+add_msg=""
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create -f ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3} raidz2 ${disk4} ${disk5} ${disk6} ${disk7}
+expect_ok ${ZPOOL} offline ${name0} ${disk1}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz2 DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo " ${disk7} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
+expect_ok ${ZPOOL} offline ${name0} ${disk3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz2 DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} OFFLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo " ${disk7} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} offline ${name0} ${disk4} ${disk7}
+add_msg=""
+expect_fl ${ZPOOL} offline ${name0} ${disk0}
+expect_fl ${ZPOOL} offline ${name0} ${disk2}
+expect_fl ${ZPOOL} offline ${name0} ${disk5} ${disk6}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz2 DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} OFFLINE 0 0 0"
+ echo " raidz2 DEGRADED 0 0 0"
+ echo " ${disk4} OFFLINE 0 0 0"
+ echo " ${disk5} ONLINE 0 0 0"
+ echo " ${disk6} ONLINE 0 0 0"
+ echo " ${disk7} OFFLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
+expect "${exp}" ${ZPOOL} status ${name0}
+add_msg=""
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/remove/cache.t b/tools/regression/zfs/zpool/remove/cache.t
new file mode 100644
index 000000000000..af3aa9ade4c1
--- /dev/null
+++ b/tools/regression/zfs/zpool/remove/cache.t
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..9"
+
+disks_create 4
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} cache ${disk1}
+expect_ok ${ZPOOL} add ${name0} cache ${disk2} ${disk3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " cache"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} remove ${name0} ${disk1} ${disk2}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " cache"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} remove ${name0} ${disk3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/remove/spare.t b/tools/regression/zfs/zpool/remove/spare.t
new file mode 100644
index 000000000000..179363b5e192
--- /dev/null
+++ b/tools/regression/zfs/zpool/remove/spare.t
@@ -0,0 +1,105 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..18"
+
+disks_create 4
+files_create 4
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} spare ${disk1}
+expect_ok ${ZPOOL} add ${name0} spare ${disk2} ${disk3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " spares"
+ echo " ${disk1} AVAIL"
+ echo " ${disk2} AVAIL"
+ echo " ${disk3} AVAIL"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} remove ${name0} ${disk1} ${disk2}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " spares"
+ echo " ${disk3} AVAIL"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} remove ${name0} ${disk3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${file0} spare ${file1}
+expect_ok ${ZPOOL} add ${name0} spare ${file2} ${file3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " spares"
+ echo " ${file1} AVAIL"
+ echo " ${file2} AVAIL"
+ echo " ${file3} AVAIL"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} remove ${name0} ${file1} ${file2}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo " spares"
+ echo " ${file3} AVAIL"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} remove ${name0} ${file3}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${file0} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+files_destroy
+disks_destroy
diff --git a/tools/regression/zfs/zpool/replace/cache.t b/tools/regression/zfs/zpool/replace/cache.t
new file mode 100644
index 000000000000..cd9fec9aeaa2
--- /dev/null
+++ b/tools/regression/zfs/zpool/replace/cache.t
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..6"
+
+disks_create 4
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} cache ${disk1}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " cache"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_fl ${ZPOOL} replace ${name0} ${disk1} ${disk2}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " cache"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/replace/disk.t b/tools/regression/zfs/zpool/replace/disk.t
new file mode 100644
index 000000000000..572c5f9694ee
--- /dev/null
+++ b/tools/regression/zfs/zpool/replace/disk.t
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..10"
+
+disks_create 4
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} ${disk0}
+expect_ok ${ZPOOL} replace ${name0} ${disk0} ${disk1}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: (scrub|resilver) completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} replace ${name0} ${disk1} ${disk3}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: (scrub|resilver) completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/replace/log.t b/tools/regression/zfs/zpool/replace/log.t
new file mode 100644
index 000000000000..d1f7b4fd5f75
--- /dev/null
+++ b/tools/regression/zfs/zpool/replace/log.t
@@ -0,0 +1,151 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..27"
+
+disks_create 4
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2}
+expect_ok ${ZPOOL} export ${name0}
+dname1=${disk1}
+fdname1=${fdisk1}
+guid1=`get_guid ${fdisk1}`
+disk_destroy 1
+disk_create 1 ${dname1}
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices could not be used because the label is missing or"
+ echo " invalid. Sufficient replicas exist for the pool to continue"
+ echo " functioning in a degraded state."
+ echo "action: Replace the device using 'zpool replace'."
+ echo " see: http://www.sun.com/msg/ZFS-8000-4J"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${guid1} UNAVAIL 0 0 0 was ${fdname1}"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+add_msg="# TODO Sun CR 6710376, Lustre bug 16912"
+expect "${exp}" ${ZPOOL} status ${name0}
+add_msg=""
+expect_ok ${ZPOOL} replace ${name0} ${disk1} ${disk3}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2}
+expect_ok ${ZPOOL} replace ${name0} ${disk2} ${disk3}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2}
+expect_ok ${ZPOOL} export ${name0}
+dname1=${disk1}
+fdname1=${fdisk1}
+guid1=`get_guid ${fdisk1}`
+disk_destroy 1
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices could not be opened. Sufficient replicas exist for"
+ echo " the pool to continue functioning in a degraded state."
+ echo "action: Attach the missing device and online it using 'zpool online'."
+ echo " see: http://www.sun.com/msg/ZFS-8000-2Q"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${guid1} UNAVAIL 0 0 0 was ${fdname1}"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} replace ${name0} ${dname1} ${disk3}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+disk_create 1 ${dname1}
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2}
+expect_ok ${ZPOOL} offline ${name0} ${disk1}
+expect_ok ${ZPOOL} replace ${name0} ${disk1} ${disk3}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " logs ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/replace/mirror.t b/tools/regression/zfs/zpool/replace/mirror.t
new file mode 100644
index 000000000000..0de1e3330335
--- /dev/null
+++ b/tools/regression/zfs/zpool/replace/mirror.t
@@ -0,0 +1,133 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..27"
+
+disks_create 3
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} export ${name0}
+dname0=${disk0}
+fdname0=${fdisk0}
+guid0=`get_guid ${fdisk0}`
+disk_destroy 0
+disk_create 0 ${dname0}
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices could not be used because the label is missing or"
+ echo " invalid. Sufficient replicas exist for the pool to continue"
+ echo " functioning in a degraded state."
+ echo "action: Replace the device using 'zpool replace'."
+ echo " see: http://www.sun.com/msg/ZFS-8000-4J"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${guid0} UNAVAIL 0 0 0 was ${fdname0}"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} replace ${name0} ${disk0} ${disk2}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: (scrub|resilver) completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk1} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} replace ${name0} ${disk1} ${disk2}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: (scrub|resilver) completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk2} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} export ${name0}
+dname0=${disk0}
+fdname0=${fdisk0}
+guid0=`get_guid ${fdisk0}`
+disk_destroy 0
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " mirror DEGRADED 0 0 0"
+ echo " ${guid0} REMOVED 0 0 0 was ${fdname0}"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} replace ${name0} ${dname0} ${disk2}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: (scrub|resilver) completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk1} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+disk_create 0 ${dname0}
+
+expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
+expect_ok ${ZPOOL} offline ${name0} ${disk1}
+expect_ok ${ZPOOL} replace ${name0} ${disk1} ${disk2}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: (scrub|resilver) completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " mirror ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk2} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/replace/raidz1.t b/tools/regression/zfs/zpool/replace/raidz1.t
new file mode 100644
index 000000000000..6b8467a3fae2
--- /dev/null
+++ b/tools/regression/zfs/zpool/replace/raidz1.t
@@ -0,0 +1,139 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..27"
+
+disks_create 4
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} export ${name0}
+dname0=${disk0}
+fdname0=${fdisk0}
+guid0=`get_guid ${fdisk0}`
+disk_destroy 0
+disk_create 0 ${dname0}
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices could not be used because the label is missing or"
+ echo " invalid. Sufficient replicas exist for the pool to continue"
+ echo " functioning in a degraded state."
+ echo "action: Replace the device using 'zpool replace'."
+ echo " see: http://www.sun.com/msg/ZFS-8000-4J"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz1 DEGRADED 0 0 0"
+ echo " ${guid0} UNAVAIL 0 0 0 was ${fdname0}"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} replace ${name0} ${disk0} ${disk3}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: (scrub|resilver) completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk1} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk2} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} replace ${name0} ${disk1} ${disk3}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: (scrub|resilver) completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk3} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk2} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} export ${name0}
+dname0=${disk0}
+fdname0=${fdisk0}
+guid0=`get_guid ${fdisk0}`
+disk_destroy 0
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz1 DEGRADED 0 0 0"
+ echo " ${guid0} REMOVED 0 0 0 was ${fdname0}"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} replace ${name0} ${dname0} ${disk3}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: (scrub|resilver) completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk1} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk2} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+disk_create 0 ${dname0}
+
+expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2}
+expect_ok ${ZPOOL} offline ${name0} ${disk1}
+expect_ok ${ZPOOL} replace ${name0} ${disk1} ${disk3}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: (scrub|resilver) completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz1 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk3} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk2} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/replace/raidz2.t b/tools/regression/zfs/zpool/replace/raidz2.t
new file mode 100644
index 000000000000..29bacda5a0e9
--- /dev/null
+++ b/tools/regression/zfs/zpool/replace/raidz2.t
@@ -0,0 +1,606 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..115"
+
+disks_create 6
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} export ${name0}
+dname0=${disk0}
+fdname0=${fdisk0}
+guid0=`get_guid ${fdisk0}`
+disk_destroy 0
+disk_create 0 ${dname0}
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices could not be used because the label is missing or"
+ echo " invalid. Sufficient replicas exist for the pool to continue"
+ echo " functioning in a degraded state."
+ echo "action: Replace the device using 'zpool replace'."
+ echo " see: http://www.sun.com/msg/ZFS-8000-4J"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz2 DEGRADED 0 0 0"
+ echo " ${guid0} UNAVAIL 0 0 0 was ${fdname0}"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} replace ${name0} ${disk0} ${disk4}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: (scrub|resilver) completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk1} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk2} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk3} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} replace ${name0} ${disk1} ${disk4}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: (scrub|resilver) completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk4} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk2} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk3} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} export ${name0}
+dname0=${disk0}
+fdname0=${fdisk0}
+guid0=`get_guid ${fdisk0}`
+disk_destroy 0
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz2 DEGRADED 0 0 0"
+ echo " ${guid0} REMOVED 0 0 0 was ${fdname0}"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} replace ${name0} ${dname0} ${disk4}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: (scrub|resilver) completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk1} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk2} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk3} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+disk_create 0 ${dname0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} offline ${name0} ${disk1}
+expect_ok ${ZPOOL} replace ${name0} ${disk1} ${disk4}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: (scrub|resilver) completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk4} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk2} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk3} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} export ${name0}
+dname0=${disk0}
+fdname0=${fdisk0}
+guid0=`get_guid ${fdisk0}`
+disk_destroy 0
+disk_create 0 ${dname0}
+dname1=${disk1}
+fdname1=${fdisk1}
+guid1=`get_guid ${fdisk1}`
+disk_destroy 1
+disk_create 1 ${dname1}
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices could not be used because the label is missing or"
+ echo " invalid. Sufficient replicas exist for the pool to continue"
+ echo " functioning in a degraded state."
+ echo "action: Replace the device using 'zpool replace'."
+ echo " see: http://www.sun.com/msg/ZFS-8000-4J"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz2 DEGRADED 0 0 0"
+ echo " ${guid0} UNAVAIL 0 0 0 was ${fdname0}"
+ echo " ${guid1} UNAVAIL 0 0 0 was ${fdname1}"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} replace ${name0} ${disk0} ${disk4}
+expect_ok ${ZPOOL} replace ${name0} ${disk1} ${disk5}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: (scrub|resilver) completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk5} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk2} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk3} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} replace ${name0} ${disk1} ${disk4}
+expect_ok ${ZPOOL} replace ${name0} ${disk2} ${disk5}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: (scrub|resilver) completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk4} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk5} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk3} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} export ${name0}
+dname0=${disk0}
+fdname0=${fdisk0}
+guid0=`get_guid ${fdisk0}`
+disk_destroy 0
+dname1=${disk1}
+fdname1=${fdisk1}
+guid1=`get_guid ${fdisk1}`
+disk_destroy 1
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz2 DEGRADED 0 0 0"
+ echo " ${guid0} REMOVED 0 0 0 was ${fdname0}"
+ echo " ${guid1} REMOVED 0 0 0 was ${fdname1}"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} replace ${name0} ${dname0} ${disk4}
+expect_ok ${ZPOOL} replace ${name0} ${dname1} ${disk5}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: (scrub|resilver) completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk5} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk2} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk3} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+disk_create 0 ${dname0}
+disk_create 1 ${dname1}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
+expect_ok ${ZPOOL} offline ${name0} ${disk1}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz2 DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} OFFLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+add_msg=""
+expect_ok ${ZPOOL} replace ${name0} ${disk0} ${disk4}
+expect_ok ${ZPOOL} replace ${name0} ${disk1} ${disk5}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: (scrub|resilver) completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk5} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk2} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk3} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} export ${name0}
+dname0=${disk0}
+fdname0=${fdisk0}
+guid0=`get_guid ${fdisk0}`
+disk_destroy 0
+disk_create 0 ${dname0}
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices could not be used because the label is missing or"
+ echo " invalid. Sufficient replicas exist for the pool to continue"
+ echo " functioning in a degraded state."
+ echo "action: Replace the device using 'zpool replace'."
+ echo " see: http://www.sun.com/msg/ZFS-8000-4J"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz2 DEGRADED 0 0 0"
+ echo " ${guid0} UNAVAIL 0 0 0 was ${fdname0}"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} replace ${name0} ${disk0} ${disk4}
+expect_ok ${ZPOOL} replace ${name0} ${disk1} ${disk5}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: (scrub|resilver) completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk5} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk2} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk3} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} export ${name0}
+dname0=${disk0}
+fdname0=${fdisk0}
+guid0=`get_guid ${fdisk0}`
+disk_destroy 0
+disk_create 0 ${dname0}
+dname1=${disk1}
+fdname1=${fdisk1}
+guid1=`get_guid ${fdisk1}`
+disk_destroy 1
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices could not be used because the label is missing or"
+ echo " invalid. Sufficient replicas exist for the pool to continue"
+ echo " functioning in a degraded state."
+ echo "action: Replace the device using 'zpool replace'."
+ echo " see: http://www.sun.com/msg/ZFS-8000-4J"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz2 DEGRADED 0 0 0"
+ echo " ${guid0} UNAVAIL 0 0 0 was ${fdname0}"
+ echo " ${guid1} REMOVED 0 0 0 was ${fdname1}"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} replace ${name0} ${disk0} ${disk4}
+expect_ok ${ZPOOL} replace ${name0} ${dname1} ${disk5}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: (scrub|resilver) completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk5} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk2} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk3} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+disk_create 1 ${dname1}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} export ${name0}
+dname0=${disk0}
+fdname0=${fdisk0}
+guid0=`get_guid ${fdisk0}`
+disk_destroy 0
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz2 DEGRADED 0 0 0"
+ echo " ${guid0} REMOVED 0 0 0 was ${fdname0}"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} replace ${name0} ${dname0} ${disk4}
+expect_ok ${ZPOOL} replace ${name0} ${disk1} ${disk5}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: (scrub|resilver) completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk5} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk2} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk3} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+disk_create 0 ${dname0}
+
+expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz2 DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${disk1} ONLINE 0 0 0"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} replace ${name0} ${disk0} ${disk4}
+expect_ok ${ZPOOL} replace ${name0} ${disk1} ${disk5}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: (scrub|resilver) completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk5} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk2} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk3} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+expect_ok ${ZPOOL} export ${name0}
+dname1=${disk1}
+fdname1=${fdisk1}
+guid1=`get_guid ${fdisk1}`
+disk_destroy 1
+disk_create 1 ${dname1}
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices could not be used because the label is missing or"
+ echo " invalid. Sufficient replicas exist for the pool to continue"
+ echo " functioning in a degraded state."
+ echo "action: Replace the device using 'zpool replace'."
+ echo " see: http://www.sun.com/msg/ZFS-8000-4J"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz2 DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${guid1} UNAVAIL 0 0 0 was ${fdname1}"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} replace ${name0} ${disk0} ${disk4}
+expect_ok ${ZPOOL} replace ${name0} ${disk1} ${disk5}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: (scrub|resilver) completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk5} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk2} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk3} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+expect_ok ${ZPOOL} create ${zpool_f_flag} ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
+expect_ok ${ZPOOL} offline ${name0} ${disk0}
+expect_ok ${ZPOOL} export ${name0}
+dname1=${disk1}
+fdname1=${fdisk1}
+guid1=`get_guid ${fdisk1}`
+disk_destroy 1
+expect_ok ${ZPOOL} import ${import_flags} ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: DEGRADED"
+ echo "status: One or more devices has been taken offline by the administrator."
+ echo " Sufficient replicas exist for the pool to continue functioning in a"
+ echo " degraded state."
+ echo "action: Online the device using 'zpool online' or replace the device with"
+ echo " 'zpool replace'."
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} DEGRADED 0 0 0"
+ echo " raidz2 DEGRADED 0 0 0"
+ echo " ${disk0} OFFLINE 0 0 0"
+ echo " ${guid1} REMOVED 0 0 0 was ${fdname1}"
+ echo " ${disk2} ONLINE 0 0 0"
+ echo " ${disk3} ONLINE 0 0 0"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} replace ${name0} ${disk0} ${disk4}
+expect_ok ${ZPOOL} replace ${name0} ${dname1} ${disk5}
+wait_for_resilver ${name0}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: (scrub|resilver) completed after [0-9]+h[0-9]+m with 0 errors on .*"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " raidz2 ONLINE 0 0 0"
+ echo " ${disk4} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk5} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk2} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo " ${disk3} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+disk_create 1 ${dname1}
+
+disks_destroy
diff --git a/tools/regression/zfs/zpool/replace/spare.t b/tools/regression/zfs/zpool/replace/spare.t
new file mode 100644
index 000000000000..7359d2234f02
--- /dev/null
+++ b/tools/regression/zfs/zpool/replace/spare.t
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+dir=`dirname $0`
+. ${dir}/../../misc.sh
+
+echo "1..6"
+
+disks_create 4
+names_create 1
+
+expect_ok ${ZPOOL} create ${name0} ${disk0} spare ${disk1}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " spares"
+ echo " ${disk1} AVAIL"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_fl ${ZPOOL} replace ${name0} ${disk1} ${disk2}
+exp=`(
+ echo " pool: ${name0}"
+ echo " state: ONLINE"
+ echo " scrub: none requested"
+ echo "config:"
+ echo " NAME STATE READ WRITE CKSUM"
+ echo " ${name0} ONLINE 0 0 0"
+ echo " ${disk0} ONLINE 0 0 0"
+ echo " spares"
+ echo " ${disk1} AVAIL"
+ echo "errors: No known data errors"
+)`
+expect "${exp}" ${ZPOOL} status ${name0}
+expect_ok ${ZPOOL} destroy ${name0}
+expect_fl ${ZPOOL} status -x ${name0}
+
+disks_destroy