summaryrefslogtreecommitdiffstats
path: root/tools/regression/zfs
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2008-11-17 20:49:29 +0000
committerpjd <pjd@FreeBSD.org>2008-11-17 20:49:29 +0000
commitbbe899b96e388a8b82439f81ed3707e0d9c6070d (patch)
tree81b89fa4ac6467771d5aa291a97f4665981a6108 /tools/regression/zfs
parentd2f579595c362ce27b4d87e2c40e1c4e09b929e3 (diff)
downloadFreeBSD-src-bbe899b96e388a8b82439f81ed3707e0d9c6070d.zip
FreeBSD-src-bbe899b96e388a8b82439f81ed3707e0d9c6070d.tar.gz
Update ZFS from version 6 to 13 and bring some FreeBSD-specific changes.
This bring huge amount of changes, I'll enumerate only user-visible changes: - Delegated Administration Allows regular users to perform ZFS operations, like file system creation, snapshot creation, etc. - L2ARC Level 2 cache for ZFS - allows to use additional disks for cache. Huge performance improvements mostly for random read of mostly static content. - slog Allow to use additional disks for ZFS Intent Log to speed up operations like fsync(2). - vfs.zfs.super_owner Allows regular users to perform privileged operations on files stored on ZFS file systems owned by him. Very careful with this one. - chflags(2) Not all the flags are supported. This still needs work. - ZFSBoot Support to boot off of ZFS pool. Not finished, AFAIK. Submitted by: dfr - Snapshot properties - New failure modes Before if write requested failed, system paniced. Now one can select from one of three failure modes: - panic - panic on write error - wait - wait for disk to reappear - continue - serve read requests if possible, block write requests - Refquota, refreservation properties Just quota and reservation properties, but don't count space consumed by children file systems, clones and snapshots. - Sparse volumes ZVOLs that don't reserve space in the pool. - External attributes Compatible with extattr(2). - NFSv4-ACLs Not sure about the status, might not be complete yet. Submitted by: trasz - Creation-time properties - Regression tests for zpool(8) command. Obtained from: OpenSolaris
Diffstat (limited to 'tools/regression/zfs')
-rw-r--r--tools/regression/zfs/LICENSE27
-rwxr-xr-xtools/regression/zfs/misc.sh436
-rw-r--r--tools/regression/zfs/zpool/add/cache.t126
-rw-r--r--tools/regression/zfs/zpool/add/disks.t60
-rw-r--r--tools/regression/zfs/zpool/add/doesnt_exist.t20
-rw-r--r--tools/regression/zfs/zpool/add/files.t231
-rw-r--r--tools/regression/zfs/zpool/add/log.t284
-rw-r--r--tools/regression/zfs/zpool/add/mirror.t86
-rw-r--r--tools/regression/zfs/zpool/add/option-f_inuse.t1186
-rw-r--r--tools/regression/zfs/zpool/add/option-f_replication_level_mismatch_0.t161
-rw-r--r--tools/regression/zfs/zpool/add/option-f_replication_level_mismatch_1.t785
-rw-r--r--tools/regression/zfs/zpool/add/option-f_size_mismatch.t434
-rw-r--r--tools/regression/zfs/zpool/add/option-f_type_mismatch.t408
-rw-r--r--tools/regression/zfs/zpool/add/option-n.t34
-rw-r--r--tools/regression/zfs/zpool/add/raidz1.t70
-rw-r--r--tools/regression/zfs/zpool/add/raidz2.t77
-rw-r--r--tools/regression/zfs/zpool/add/spare.t137
-rw-r--r--tools/regression/zfs/zpool/attach/log.t232
-rw-r--r--tools/regression/zfs/zpool/attach/mirror.t208
-rw-r--r--tools/regression/zfs/zpool/attach/option-f_inuse.t670
-rw-r--r--tools/regression/zfs/zpool/create/already_exists.t28
-rw-r--r--tools/regression/zfs/zpool/create/automount.t22
-rw-r--r--tools/regression/zfs/zpool/create/cache.t126
-rw-r--r--tools/regression/zfs/zpool/create/disks.t52
-rw-r--r--tools/regression/zfs/zpool/create/files.t189
-rw-r--r--tools/regression/zfs/zpool/create/log.t202
-rw-r--r--tools/regression/zfs/zpool/create/mirror.t83
-rw-r--r--tools/regression/zfs/zpool/create/option-R.t30
-rw-r--r--tools/regression/zfs/zpool/create/option-f_inuse.t297
-rw-r--r--tools/regression/zfs/zpool/create/option-f_replication_level_mismatch_0.t200
-rw-r--r--tools/regression/zfs/zpool/create/option-f_replication_level_mismatch_1.t540
-rw-r--r--tools/regression/zfs/zpool/create/option-f_size_mismatch.t256
-rw-r--r--tools/regression/zfs/zpool/create/option-f_type_mismatch.t414
-rw-r--r--tools/regression/zfs/zpool/create/option-m.t59
-rw-r--r--tools/regression/zfs/zpool/create/option-n.t23
-rw-r--r--tools/regression/zfs/zpool/create/option-o.t107
-rw-r--r--tools/regression/zfs/zpool/create/raidz1.t129
-rw-r--r--tools/regression/zfs/zpool/create/raidz2.t91
-rw-r--r--tools/regression/zfs/zpool/create/spare.t104
-rw-r--r--tools/regression/zfs/zpool/offline/io.t85
-rw-r--r--tools/regression/zfs/zpool/offline/log.t254
-rw-r--r--tools/regression/zfs/zpool/offline/mirror.t224
-rw-r--r--tools/regression/zfs/zpool/offline/option-t.t1110
-rw-r--r--tools/regression/zfs/zpool/offline/raidz1.t184
-rw-r--r--tools/regression/zfs/zpool/offline/raidz2.t202
-rw-r--r--tools/regression/zfs/zpool/remove/cache.t58
-rw-r--r--tools/regression/zfs/zpool/remove/spare.t106
-rw-r--r--tools/regression/zfs/zpool/replace/cache.t43
-rw-r--r--tools/regression/zfs/zpool/replace/disk.t48
-rw-r--r--tools/regression/zfs/zpool/replace/log.t152
-rw-r--r--tools/regression/zfs/zpool/replace/mirror.t134
-rw-r--r--tools/regression/zfs/zpool/replace/raidz1.t140
-rw-r--r--tools/regression/zfs/zpool/replace/raidz2.t607
-rw-r--r--tools/regression/zfs/zpool/replace/spare.t43
54 files changed, 12014 insertions, 0 deletions
diff --git a/tools/regression/zfs/LICENSE b/tools/regression/zfs/LICENSE
new file mode 100644
index 0000000..45b9cac
--- /dev/null
+++ b/tools/regression/zfs/LICENSE
@@ -0,0 +1,27 @@
+$FreeBSD$
+
+License for all ZFS regression tests:
+
+Copyright (c) 2008 Pawel Jakub Dawidek <pjd@FreeBSD.org>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
diff --git a/tools/regression/zfs/misc.sh b/tools/regression/zfs/misc.sh
new file mode 100755
index 0000000..d96aa22
--- /dev/null
+++ b/tools/regression/zfs/misc.sh
@@ -0,0 +1,436 @@
+# $FreeBSD$
+
+ntest=1
+os=`uname -s`
+
+echo ${dir} | egrep '^/' >/dev/null 2>&1
+if [ $? -eq 0 ]; then
+ maindir="${dir}/../.."
+else
+ maindir="`pwd`/${dir}/../.."
+fi
+
+# Set up correct command names and switches
+if [ -z "${LUSTRE}" ]; then
+ ZPOOL="zpool"
+ ZFS="zfs"
+ ZDB="zdb"
+ zpool_f_flag="-f"
+else
+ ZPOOL="lzpool"
+ ZFS="lzfs"
+ ZDB="lzdb"
+ zpool_f_flag="-F"
+ no_mountpoint=1
+fi
+
+# Use correct arguments to cmd line programs
+stat --version 2>/dev/null | grep GNU >/dev/null
+if [ $? -eq 0 ]; then
+ GNU_STAT="yes"
+fi
+if [ "${os}" = "SunOS" ]; then
+ import_flags="-d /dev/lofi"
+ mount_t_flag="-F"
+else
+ mount_t_flag="-t"
+fi
+
+die()
+{
+ echo "${1}" > /dev/stderr
+ exit 1
+}
+
+calcsum()
+{
+ dd if="${1}" bs=1M 2>/dev/null | openssl md5
+}
+
+create_file()
+{
+ name="${1}"
+ size="${2}"
+
+ dd if=/dev/urandom of=${name} bs=${size} count=1 >/dev/null 2>&1
+ sync
+}
+
+expect()
+{
+ eorig="${1}"
+ eexp=`echo "${eorig}" | egrep -v '^[ ]*$' | sed 's/^[ ][ ]*//g;s/[ ][ ]*$//g;s/[ ][ ]*/ /g;s/$/%EoL%/' | xargs`
+ shift
+ gorig=`sh -c "$*" 2>&1`
+ got=`echo "${gorig}" | egrep -v '^[ ]*$' | sed 's/^[ ][ ]*//g;s/[ ][ ]*$//g;s/[ ][ ]*/ /g;s/$/%EoL%/' | xargs`
+ echo "${got}" | egrep "${eexp}" >/dev/null
+ if [ $? -eq 0 ]; then
+ echo "ok ${ntest} ${add_msg}"
+ else
+ echo "not ok ${ntest} ${add_msg}"
+ echo "# ----- expected from: $*"
+ echo "${eorig}" | sed 's/^/# /'
+ echo "# ----- got:"
+ echo "${gorig}" | sed 's/^/# /'
+ echo "# ----- end"
+ fi
+ ntest=`expr $ntest + 1`
+}
+
+expect_ok()
+{
+ out=`$* 2>&1`
+ ec=$?
+ if [ $ec -eq 0 ]; then
+ echo "ok ${ntest} ${add_msg}"
+ echo "# ----- expected success from: $*"
+ if [ ! -z "${out}" ]; then
+ echo "# ----- output (exit code=${ec}):"
+ echo "${out}" | sed 's/^/# /'
+ echo "# ----- end"
+ fi
+ else
+ echo "not ok ${ntest} ${add_msg}"
+ echo "# ----- expected success from: $*"
+ echo "# ----- output (exit code=${ec}):"
+ echo "${out}" | sed 's/^/# /'
+ echo "# ----- end"
+ fi
+ ntest=`expr $ntest + 1`
+}
+
+expect_fl()
+{
+ out=`$* 2>&1`
+ ec=$?
+ if [ $ec -ne 0 ]; then
+ echo "ok ${ntest} ${add_msg}"
+ echo "# ----- expected failure from: $*"
+ if [ ! -z "${out}" ]; then
+ echo "# ----- output (exit code=${ec}):"
+ echo "${out}" | sed 's/^/# /'
+ echo "# ----- end"
+ fi
+ else
+ echo "not ok ${ntest} ${add_msg}"
+ echo "# ----- expected failure from: $*"
+ echo "# ----- output (exit code=${ec}):"
+ echo "${out}" | sed 's/^/# /'
+ echo "# ----- end"
+ fi
+ ntest=`expr $ntest + 1`
+}
+
+quick_exit()
+{
+ echo "1..1"
+ echo "ok 1"
+ exit 0
+}
+
+# Set up a scratch tmpfs directory (Linux only)
+setup_tmpfs()
+{
+ cmd="mktemp -d /tmp/zfs-regression.XXXXXXXXXX"
+ TMPDIR=`${cmd}` || die "failed: ${cmd}"
+ cmd="mount -t tmpfs none ${TMPDIR}"
+ ${cmd} || die "failed: ${cmd}"
+}
+
+# Clean up the tmpfs directory (Linux only)
+cleanup_tmpfs()
+{
+ if [ -n "${TMPDIR}" ]; then
+ cmd="umount ${TMPDIR} && rmdir ${TMPDIR}"
+ eval "${cmd}" || die "failed: ${cmd}"
+ fi
+}
+
+# Truncate a file
+truncate_cmd()
+{
+ size="${1}"
+ file="${2}"
+
+ cmd="dd if=/dev/null of=${file} bs=1 count=0 seek=${size}"
+ ${cmd} > /dev/null 2>&1 || die "failed: ${cmd}"
+}
+
+# Create a memory-backed block device
+create_memdisk()
+{
+ size="${1}"
+ devname="${2}"
+
+ if [ "${os}" = "FreeBSD" ]; then
+ if [ -n "${devname}" ]; then
+ devparam="-u ${devname}"
+ fi
+ cmd="mdconfig -a -t swap -s ${size} ${devparam} 2>/dev/null"
+ DISKNAME=`${cmd}` || die "failed: ${cmd}"
+ if [ -n "${devname}" ]; then
+ DISKNAME="${devname}"
+ fi
+ FDISKNAME="/dev/${DISKNAME}"
+ elif [ "${os}" = "SunOS" ]; then
+ cmd="mktemp /tmp/zfstest.XXXXXXXXXX"
+ fname=`${cmd}` || die "failed: ${cmd}"
+
+ truncate_cmd "${size}" "${fname}"
+
+ if [ -n "${devname}" ]; then
+ cmd="lofiadm -a ${fname} ${devname}"
+ ${cmd} || die "failed: ${cmd}"
+ DISKNAME="${devname}"
+ else
+ cmd="lofiadm -a ${fname}"
+ DISKNAME=`${cmd}` || die "failed: ${cmd}"
+ fi
+ FDISKNAME="${DISKNAME}"
+ elif [ "${os}" = "Linux" ]; then
+ if [ -z "${TMPDIR_DISKS}" ]; then
+ setup_tmpfs
+ TMPDIR_DISKS="${TMPDIR}"
+ fi
+
+ cmd="mktemp ${TMPDIR_DISKS}/disk.XXXXXXXXXX"
+ fname=`${cmd}` || die "failed: ${cmd}"
+
+ truncate_cmd "${size}" "${fname}"
+
+ if [ -n "${devname}" ]; then
+ devname=`echo ${devname} | cut -c 9-`
+ cmd="losetup /dev/${devname} ${fname} 2>&1"
+ eval ${cmd} || die "failed: ${cmd}"
+ DISKNAME="${devname}"
+ else
+ cmd="losetup -s -f ${fname} 2>&1"
+ diskname=`eval ${cmd}`
+
+ if [ "${diskname}" = "losetup: could not find any free loop device" ]; then
+ # If there are no free loopback devices, create one more
+ max=`echo /dev/loop* | awk 'BEGIN { RS=" "; FS="loop" } {if ($2 > max) max = $2} END {print max}'`
+ max=$((max + 1))
+ cmd="mknod /dev/loop${max} b 7 ${max}"
+ ${cmd} || die "failed: ${cmd}"
+
+ cmd="losetup -s -f ${fname}"
+ diskname=`${cmd}` || die "failed: ${cmd}"
+ fi
+ DISKNAME=`eval echo ${diskname} | sed 's/^\/dev\///'`
+ fi
+ ln /dev/${DISKNAME} /dev/zfstest_${DISKNAME}
+ DISKNAME="zfstest_${DISKNAME}"
+ FDISKNAME="/dev/${DISKNAME}"
+ else
+ die "Sorry, your OS is not supported"
+ fi
+}
+
+# Destroy a memory-backed block device
+destroy_memdisk()
+{
+ disk="${1}"
+
+ if [ "${os}" = "FreeBSD" ]; then
+ cmd="mdconfig -d -u ${disk}"
+ ${cmd} || die "failed: ${cmd}"
+ elif [ "${os}" = "SunOS" ]; then
+ cmd="lofiadm ${disk}"
+ fname=`${cmd}` || die "failed: ${cmd}"
+
+ cmd="lofiadm -d ${disk}"
+ ${cmd} || die "failed: ${cmd}"
+
+ cmd="rm ${fname}"
+ ${cmd} || die "failed: ${cmd}"
+ elif [ "${os}" = "Linux" ]; then
+ cmd="rm /dev/${disk}"
+ ${cmd} || die "failed: ${cmd}"
+ disk=`echo ${disk} | cut -c 9-`
+
+ cmd="losetup /dev/${disk} | awk '{print substr(\$3, 2, length(\$3)-2)}'"
+ fname=`eval ${cmd}` || die "failed: ${cmd}"
+
+ cmd="losetup -d /dev/${disk}"
+ ${cmd} || die "failed: ${cmd}"
+
+ cmd="rm ${fname}"
+ ${cmd} || die "failed: ${cmd}"
+ else
+ die "Sorry, your OS is not supported"
+ fi
+}
+
+disks_create()
+{
+ if [ -z "${ndisks}" ]; then
+ start=0
+ else
+ start=${ndisks}
+ fi
+ ndisks=$((start+$1))
+ n=$((ndisks-$start))
+ if [ -z "${2}" ]; then
+ size="96M"
+ else
+ size="${2}"
+ fi
+ for i in `nums $n $start`; do
+ create_memdisk ${size}
+ eval disk${i}="${DISKNAME}"
+ eval fdisk${i}="${FDISKNAME}"
+ done
+}
+
+disks_destroy()
+{
+ for i in `nums $ndisks 0`; do
+ eval disk=\$disk${i}
+ if [ ! -z "${disk}" ]; then
+ destroy_memdisk ${disk}
+ fi
+ done
+ [ -n "${TMPDIR_DISKS}" ] && TMPDIR="${TMPDIR_DISKS}" cleanup_tmpfs
+ return 0
+}
+
+disk_create()
+{
+ diskno=${1}
+ eval disk=\$disk${diskno}
+ if [ ! -z ${disk} ]; then
+ die "disk${diskno} is already set"
+ fi
+ dname=${2}
+ if [ -z "${3}" ]; then
+ size="96M"
+ else
+ size="${3}"
+ fi
+ create_memdisk ${size} ${dname}
+ [ "${DISKNAME}" = "${dname}" ] || die "${DISKNAME} != ${dname}"
+ eval disk${diskno}="${DISKNAME}"
+ eval fdisk${diskno}="${FDISKNAME}"
+}
+
+disk_destroy()
+{
+ eval disk=\$disk${1}
+ destroy_memdisk ${disk}
+ eval disk${1}=""
+}
+
+files_create()
+{
+ if [ -z "${nfiles}" ]; then
+ start=0
+ else
+ start=${nfiles}
+ fi
+ nfiles=$((start+$1))
+ n=$((nfiles-$start))
+ if [ -z "${2}" ]; then
+ size="96M"
+ else
+ size="${2}"
+ fi
+ for i in `nums $n $start`; do
+ if [ "${os}" = "Linux" ]; then
+ if [ -z "${TMPDIR_FILES}" ]; then
+ setup_tmpfs
+ TMPDIR_FILES="${TMPDIR}"
+ fi
+ file=`mktemp ${TMPDIR_FILES}/zfstest.XXXXXXXX`
+ else
+ file=`mktemp /tmp/zfstest.XXXXXXXX`
+ fi
+ truncate_cmd ${size} ${file}
+ eval file${i}=${file}
+ done
+}
+
+files_destroy()
+{
+ for i in `nums $nfiles 0`; do
+ eval file=\$file${i}
+ rm -f ${file}
+ done
+ nfiles=0
+ [ -n "${TMPDIR_FILES}" ] && TMPDIR="${TMPDIR_FILES}" cleanup_tmpfs
+ return 0
+}
+
+name_create()
+{
+ echo "zfstest_`dd if=/dev/urandom bs=1k count=1 2>/dev/null | openssl md5 | cut -b -8`"
+}
+
+names_create()
+{
+ nnames=$1
+ for i in `nums $nnames 0`; do
+ eval name${i}=`name_create`
+ done
+}
+
+is_mountpoint()
+{
+ dir="${1}"
+ if [ ! -d "${dir}" ]; then
+ return 1
+ fi
+ if [ -n "${GNU_STAT}" ]; then
+ statcmd="stat -c"
+ else
+ statcmd="stat -f"
+ fi
+ if [ "`${statcmd} '%d' ${dir} 2>/dev/null`" -eq "`${statcmd} '%d' ${dir}/.. 2>/dev/null`" ]; then
+ return 1
+ fi
+ return 0
+}
+
+nums()
+{
+ which jot >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ jot ${1} ${2}
+ return $?
+ fi
+
+ start="${2}"
+ [ -z "${start}" ] && start="1";
+ end=$((${1}+${start}-1))
+
+ which seq >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ seq ${start} ${end}
+ return $?
+ fi
+
+ i=1
+ while :; do
+ echo $i
+ if [ $i -eq ${1} ]; then
+ break
+ fi
+ i=$((i+1))
+ done
+}
+
+wait_for_resilver()
+{
+ for i in `nums 64`; do
+ ${ZPOOL} status ${1} | grep replacing >/dev/null
+ if [ $? -ne 0 ]; then
+ break
+ fi
+ sleep 1
+ done
+}
+
+get_guid()
+{
+ ${ZDB} -l ${1} | grep -B1 ${1} | grep guid | head -n1 | awk 'BEGIN {FS="="} {print $2}'
+}
diff --git a/tools/regression/zfs/zpool/add/cache.t b/tools/regression/zfs/zpool/add/cache.t
new file mode 100644
index 0000000..abaaf41
--- /dev/null
+++ b/tools/regression/zfs/zpool/add/cache.t
@@ -0,0 +1,126 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..e12f5fe
--- /dev/null
+++ b/tools/regression/zfs/zpool/add/disks.t
@@ -0,0 +1,60 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..d099afc
--- /dev/null
+++ b/tools/regression/zfs/zpool/add/doesnt_exist.t
@@ -0,0 +1,20 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..59014aa
--- /dev/null
+++ b/tools/regression/zfs/zpool/add/files.t
@@ -0,0 +1,231 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..516ab1b
--- /dev/null
+++ b/tools/regression/zfs/zpool/add/log.t
@@ -0,0 +1,284 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..25ff59e
--- /dev/null
+++ b/tools/regression/zfs/zpool/add/mirror.t
@@ -0,0 +1,86 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..5cc86c3
--- /dev/null
+++ b/tools/regression/zfs/zpool/add/option-f_inuse.t
@@ -0,0 +1,1186 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..83b0a595
--- /dev/null
+++ b/tools/regression/zfs/zpool/add/option-f_replication_level_mismatch_0.t
@@ -0,0 +1,161 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..6b19b0a
--- /dev/null
+++ b/tools/regression/zfs/zpool/add/option-f_replication_level_mismatch_1.t
@@ -0,0 +1,785 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..79281e5
--- /dev/null
+++ b/tools/regression/zfs/zpool/add/option-f_size_mismatch.t
@@ -0,0 +1,434 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..a79bce9
--- /dev/null
+++ b/tools/regression/zfs/zpool/add/option-f_type_mismatch.t
@@ -0,0 +1,408 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..5f8b5c0
--- /dev/null
+++ b/tools/regression/zfs/zpool/add/option-n.t
@@ -0,0 +1,34 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..cd004a2
--- /dev/null
+++ b/tools/regression/zfs/zpool/add/raidz1.t
@@ -0,0 +1,70 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..20fca8a
--- /dev/null
+++ b/tools/regression/zfs/zpool/add/raidz2.t
@@ -0,0 +1,77 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..816e385
--- /dev/null
+++ b/tools/regression/zfs/zpool/add/spare.t
@@ -0,0 +1,137 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..dde5995
--- /dev/null
+++ b/tools/regression/zfs/zpool/attach/log.t
@@ -0,0 +1,232 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..ac3fe2d
--- /dev/null
+++ b/tools/regression/zfs/zpool/attach/mirror.t
@@ -0,0 +1,208 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..a62d360
--- /dev/null
+++ b/tools/regression/zfs/zpool/attach/option-f_inuse.t
@@ -0,0 +1,670 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..f300580
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/already_exists.t
@@ -0,0 +1,28 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..175f2ab
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/automount.t
@@ -0,0 +1,22 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..13af7f1
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/cache.t
@@ -0,0 +1,126 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..b6b722c
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/disks.t
@@ -0,0 +1,52 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..06107b2
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/files.t
@@ -0,0 +1,189 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..18105fb
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/log.t
@@ -0,0 +1,202 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..49572e8
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/mirror.t
@@ -0,0 +1,83 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..75182a0
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/option-R.t
@@ -0,0 +1,30 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..344b9c1
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/option-f_inuse.t
@@ -0,0 +1,297 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..27ffede
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/option-f_replication_level_mismatch_0.t
@@ -0,0 +1,200 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..d64db3a
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/option-f_replication_level_mismatch_1.t
@@ -0,0 +1,540 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..74af390
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/option-f_size_mismatch.t
@@ -0,0 +1,256 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..7739eb8
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/option-f_type_mismatch.t
@@ -0,0 +1,414 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..357959e
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/option-m.t
@@ -0,0 +1,59 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..0cb3e7f
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/option-n.t
@@ -0,0 +1,23 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..3305323
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/option-o.t
@@ -0,0 +1,107 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..382f7e7
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/raidz1.t
@@ -0,0 +1,129 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..587d3dc
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/raidz2.t
@@ -0,0 +1,91 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..46f47da
--- /dev/null
+++ b/tools/regression/zfs/zpool/create/spare.t
@@ -0,0 +1,104 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..8faeb8a2
--- /dev/null
+++ b/tools/regression/zfs/zpool/offline/io.t
@@ -0,0 +1,85 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..2a741ba
--- /dev/null
+++ b/tools/regression/zfs/zpool/offline/log.t
@@ -0,0 +1,254 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..37778fc
--- /dev/null
+++ b/tools/regression/zfs/zpool/offline/mirror.t
@@ -0,0 +1,224 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..c408796
--- /dev/null
+++ b/tools/regression/zfs/zpool/offline/option-t.t
@@ -0,0 +1,1110 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..d6827ca
--- /dev/null
+++ b/tools/regression/zfs/zpool/offline/raidz1.t
@@ -0,0 +1,184 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..299649d
--- /dev/null
+++ b/tools/regression/zfs/zpool/offline/raidz2.t
@@ -0,0 +1,202 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..fd55451
--- /dev/null
+++ b/tools/regression/zfs/zpool/remove/cache.t
@@ -0,0 +1,58 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..c52f220
--- /dev/null
+++ b/tools/regression/zfs/zpool/remove/spare.t
@@ -0,0 +1,106 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..23abc37
--- /dev/null
+++ b/tools/regression/zfs/zpool/replace/cache.t
@@ -0,0 +1,43 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..51029e6
--- /dev/null
+++ b/tools/regression/zfs/zpool/replace/disk.t
@@ -0,0 +1,48 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..6eed8bd
--- /dev/null
+++ b/tools/regression/zfs/zpool/replace/log.t
@@ -0,0 +1,152 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..6e9dafe
--- /dev/null
+++ b/tools/regression/zfs/zpool/replace/mirror.t
@@ -0,0 +1,134 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..79bcf8e
--- /dev/null
+++ b/tools/regression/zfs/zpool/replace/raidz1.t
@@ -0,0 +1,140 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..d961e3c
--- /dev/null
+++ b/tools/regression/zfs/zpool/replace/raidz2.t
@@ -0,0 +1,607 @@
+#!/bin/sh
+# $FreeBSD$
+
+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 0000000..5899305
--- /dev/null
+++ b/tools/regression/zfs/zpool/replace/spare.t
@@ -0,0 +1,43 @@
+#!/bin/sh
+# $FreeBSD$
+
+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
OpenPOWER on IntegriCloud