diff options
Diffstat (limited to 'scripts/zpool-config')
29 files changed, 0 insertions, 1601 deletions
diff --git a/scripts/zpool-config/Makefile.am b/scripts/zpool-config/Makefile.am deleted file mode 100644 index 2d7799413..000000000 --- a/scripts/zpool-config/Makefile.am +++ /dev/null @@ -1,30 +0,0 @@ -pkgdataconfigdir = $(pkgdatadir)/zpool-config -dist_pkgdataconfig_SCRIPTS = \ - $(top_srcdir)/scripts/zpool-config/dm0-raid0.sh \ - $(top_srcdir)/scripts/zpool-config/file-raid0.sh \ - $(top_srcdir)/scripts/zpool-config/file-raid10.sh \ - $(top_srcdir)/scripts/zpool-config/file-raidz2.sh \ - $(top_srcdir)/scripts/zpool-config/file-raidz.sh \ - $(top_srcdir)/scripts/zpool-config/hda-raid0.sh \ - $(top_srcdir)/scripts/zpool-config/lo-raid0.sh \ - $(top_srcdir)/scripts/zpool-config/lo-raid10.sh \ - $(top_srcdir)/scripts/zpool-config/lo-raidz2.sh \ - $(top_srcdir)/scripts/zpool-config/lo-raidz.sh \ - $(top_srcdir)/scripts/zpool-config/lo-faulty-raid0.sh \ - $(top_srcdir)/scripts/zpool-config/lo-faulty-raid10.sh \ - $(top_srcdir)/scripts/zpool-config/lo-faulty-raidz.sh \ - $(top_srcdir)/scripts/zpool-config/lo-faulty-raidz2.sh \ - $(top_srcdir)/scripts/zpool-config/lo-faulty-raidz3.sh \ - $(top_srcdir)/scripts/zpool-config/md0-raid10.sh \ - $(top_srcdir)/scripts/zpool-config/md0-raid5.sh \ - $(top_srcdir)/scripts/zpool-config/ram0-raid0.sh \ - $(top_srcdir)/scripts/zpool-config/scsi_debug-noraid.sh \ - $(top_srcdir)/scripts/zpool-config/scsi_debug-raid0.sh \ - $(top_srcdir)/scripts/zpool-config/scsi_debug-raid10.sh \ - $(top_srcdir)/scripts/zpool-config/scsi_debug-raidz.sh \ - $(top_srcdir)/scripts/zpool-config/scsi_debug-raidz2.sh \ - $(top_srcdir)/scripts/zpool-config/scsi_debug-raidz3.sh \ - $(top_srcdir)/scripts/zpool-config/sda-raid0.sh \ - $(top_srcdir)/scripts/zpool-config/zpool-raid0.sh \ - $(top_srcdir)/scripts/zpool-config/zpool-raid10.sh \ - $(top_srcdir)/scripts/zpool-config/zpool-raidz.sh diff --git a/scripts/zpool-config/dm0-raid0.sh b/scripts/zpool-config/dm0-raid0.sh deleted file mode 100644 index f7fa8f60a..000000000 --- a/scripts/zpool-config/dm0-raid0.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash -# -# Four disk Raid-0 DM in a single Raid-0 Configuration -# - -PVCREATE=${PVCREATE:-/sbin/pvcreate} -PVREMOVE=${PVREMOVE:-/sbin/pvremove} -PVDEVICES=${PVDEVICES:-"/dev/sd[abcd]"} - -VGCREATE=${VGCREATE:-/sbin/vgcreate} -VGREMOVE=${VGREMOVE:-/sbin/vgremove} -VGNAME=${VGNAME:-"vg_tank"} - -LVCREATE=${LVCREATE:-/sbin/lvcreate} -LVREMOVE=${LVREMOVE:-/sbin/lvremove} -LVNAME=${LVNAME:-"lv_tank"} -LVSTRIPES=${LVSTRIPES:-4} -LVSIZE=${LVSIZE:-32G} - -DEVICES="/dev/${VGNAME}/${LVNAME}" - -zpool_dm_destroy() { - msg ${LVREMOVE} -f ${VGNAME}/${LVNAME} - ${LVREMOVE} -f ${VGNAME}/${LVNAME} >/dev/null - - msg ${VGREMOVE} -f ${VGNAME} - ${VGREMOVE} -f ${VGNAME} >/dev/null - - msg ${PVREMOVE} ${PVDEVICES} - ${PVREMOVE} ${PVDEVICES} >/dev/null -} - -zpool_create() { - # Remove EFI labels which cause pvcreate failure - for DEVICE in ${PVDEVICES}; do - dd if=/dev/urandom of=${DEVICE} bs=1k count=32 &>/dev/null - done - - msg ${PVCREATE} -f ${PVDEVICES} - ${PVCREATE} -f ${PVDEVICES} >/dev/null || exit 1 - - msg ${VGCREATE} ${VGNAME} ${PVDEVICES} - ${VGCREATE} ${VGNAME} ${PVDEVICES} >/dev/null || exit 2 - - msg ${LVCREATE} --size=${LVSIZE} --stripes=${LVSTRIPES} \ - --name=${LVNAME} ${VGNAME} - ${LVCREATE} --size=${LVSIZE} --stripes=${LVSTRIPES} \ - --name=${LVNAME} ${VGNAME} >/dev/null || exit 3 - - msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES} - ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} \ - ${DEVICES} || (zpool_dm_destroy && exit 4) -} - -zpool_destroy() { - msg ${ZPOOL} destroy ${ZPOOL_NAME} - ${ZPOOL} destroy ${ZPOOL_NAME} - - zpool_dm_destroy -} diff --git a/scripts/zpool-config/file-raid0.sh b/scripts/zpool-config/file-raid0.sh deleted file mode 100644 index 24b6aec4d..000000000 --- a/scripts/zpool-config/file-raid0.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -# -# 4 File Raid-0 Configuration -# - -FILEDIR=${FILEDIR:-/var/tmp} -FILES=${FILES:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1 \ - $FILEDIR/file-vdev2 $FILEDIR/file-vdev3"} - -zpool_create() { - for FILE in ${FILES}; do - msg "Creating ${FILE}" - rm -f ${FILE} || exit 1 - dd if=/dev/zero of=${FILE} bs=1024k count=0 seek=256 \ - &>/dev/null || die "Error $? creating ${FILE}" - done - - msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${FILES} - ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${FILES} || exit 1 -} - -zpool_destroy() { - msg ${ZPOOL} destroy ${ZPOOL_NAME} - ${ZPOOL} destroy ${ZPOOL_NAME} - - for FILE in ${FILES}; do - msg "Removing ${FILE}" - rm -f ${FILE} || exit 1 - done -} diff --git a/scripts/zpool-config/file-raid10.sh b/scripts/zpool-config/file-raid10.sh deleted file mode 100644 index 92b22c2fd..000000000 --- a/scripts/zpool-config/file-raid10.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# -# 4 File Raid-10 Configuration -# - -FILEDIR=${FILEDIR:-/var/tmp} -FILES_M1=${FILES_M1:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1"} -FILES_M2=${FILES_M2:-"$FILEDIR/file-vdev2 $FILEDIR/file-vdev3"} -FILES="${FILES_M1} ${FILES_M2}" - -zpool_create() { - for FILE in ${FILES}; do - msg "Creating ${FILE}" - rm -f ${FILE} || exit 1 - dd if=/dev/zero of=${FILE} bs=1024k count=0 seek=256 \ - &>/dev/null || die "Error $? creating ${FILE}" - done - - msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} \ - mirror ${FILES_M1} mirror ${FILES_M2} - ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} \ - mirror ${FILES_M1} mirror ${FILES_M2} || exit 1 -} - -zpool_destroy() { - msg ${ZPOOL} destroy ${ZPOOL_NAME} - ${ZPOOL} destroy ${ZPOOL_NAME} - - for FILE in ${FILES}; do - msg "Removing ${FILE}" - rm -f ${FILE} || exit 1 - done -} diff --git a/scripts/zpool-config/file-raidz.sh b/scripts/zpool-config/file-raidz.sh deleted file mode 100644 index 4112deba7..000000000 --- a/scripts/zpool-config/file-raidz.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -# -# 4 File Raid-Z Configuration -# - -FILEDIR=${FILEDIR:-/var/tmp} -FILES=${FILES:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1 \ - $FILEDIR/file-vdev2 $FILEDIR/file-vdev3"} - -zpool_create() { - for FILE in ${FILES}; do - msg "Creating ${FILE}" - rm -f ${FILE} || exit 1 - dd if=/dev/zero of=${FILE} bs=1024k count=0 seek=256 \ - &>/dev/null || die "Error $? creating ${FILE}" - done - - msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz ${FILES} - ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz ${FILES} || exit 1 -} - -zpool_destroy() { - msg ${ZPOOL} destroy ${ZPOOL_NAME} - ${ZPOOL} destroy ${ZPOOL_NAME} - - for FILE in ${FILES}; do - msg "Removing ${FILE}" - rm -f ${FILE} || exit 1 - done -} diff --git a/scripts/zpool-config/file-raidz2.sh b/scripts/zpool-config/file-raidz2.sh deleted file mode 100644 index 6e03da869..000000000 --- a/scripts/zpool-config/file-raidz2.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -# -# 4 File Raid-Z2 Configuration -# - -FILEDIR=${FILEDIR:-/var/tmp} -FILES=${FILES:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1 \ - $FILEDIR/file-vdev2 $FILEDIR/file-vdev3"} - -zpool_create() { - for FILE in ${FILES}; do - msg "Creating ${FILE}" - rm -f ${FILE} || exit 1 - dd if=/dev/zero of=${FILE} bs=1024k count=0 seek=256 \ - &>/dev/null || die "Error $? creating ${FILE}" - done - - msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz2 ${FILES} - ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz2 ${FILES} || exit 1 -} - -zpool_destroy() { - msg ${ZPOOL} destroy ${ZPOOL_NAME} - ${ZPOOL} destroy ${ZPOOL_NAME} - - for FILE in ${FILES}; do - msg "Removing ${FILE}" - rm -f ${FILE} || exit 1 - done -} diff --git a/scripts/zpool-config/hda-raid0.sh b/scripts/zpool-config/hda-raid0.sh deleted file mode 100644 index 0623963fd..000000000 --- a/scripts/zpool-config/hda-raid0.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# -# Single disk /dev/hda Raid-0 Configuration -# - -DEVICES="/dev/hda" - -zpool_create() { - msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES} - ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES} || exit 1 -} - -zpool_destroy() { - msg ${ZPOOL} destroy ${ZPOOL_NAME} - ${ZPOOL} destroy ${ZPOOL_NAME} || exit 1 -} diff --git a/scripts/zpool-config/lo-faulty-raid0.sh b/scripts/zpool-config/lo-faulty-raid0.sh deleted file mode 100644 index 72894ee23..000000000 --- a/scripts/zpool-config/lo-faulty-raid0.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/bash -# -# 4 loopback devices using the md faulty level for easy -# fault injection on top of which is layered raid0 (striped). -# -# zpool-vdev0 zpool-vdev1 zpool-vdev2 zpool-vdev3 -# loop0 loop1 loop2 loop3 -# md0 (faulty) md1 (faulty) md2 (faulty) md3 (faulty) -# <--------------------- raid0 zpool ---------------------> -# - -FILEDIR=${FILEDIR:-/var/tmp} -FILES=${FILES:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1 \ - $FILEDIR/file-vdev2 $FILEDIR/file-vdev3"} -LODEVICES="" -MDDEVICES="" - -zpool_create() { - check_loop_utils - check_md_utils - check_md_partitionable || die "Error non-partitionable md devices" - - for FILE in ${FILES}; do - LODEVICE=`unused_loop_device` - MDDEVICE=`unused_md_device` - - rm -f ${FILE} || exit 1 - dd if=/dev/zero of=${FILE} bs=1M count=0 seek=256 \ - &>/dev/null || die "Error $? creating ${FILE}" - - # Setup the loopback device on the file. - msg "Creating ${LODEVICE} using ${FILE}" - ${LOSETUP} ${LODEVICE} ${FILE} || \ - die "Error $? creating ${LODEVICE} using ${FILE}" - - LODEVICES="${LODEVICES} ${LODEVICE}" - - # Setup the md device on the loopback device. - msg "Creating ${MDDEVICE} using ${LODEVICE}" - ${MDADM} --build ${MDDEVICE} --level=faulty \ - --raid-devices=1 ${LODEVICE} &>/dev/null || \ - (destroy_md_devices "${MDDEVICES}" && \ - destroy_loop_devices "${LODEVICES}" && \ - die "Error $? creating ${MDDEVICE} using ${LODEVICE}") - wait_udev ${MDDEVICE} 30 || \ - (destroy_md_devices "${MDDEVICES}" && \ - destroy_loop_devices "${LODEVICES}" && \ - die "Error udev never created ${MDDEVICE}") - - # Check if the md device support partitions - ${BLOCKDEV} --rereadpt ${MDDEVICE} 2>/dev/null || \ - (destroy_md_devices "${MDDEVICES}" && \ - destroy_loop_devices "${LODEVICES}" && \ - die "Error ${MDDEVICE} does not support partitions") - - # Create a GPT/EFI partition table for ZFS to use. - ${PARTED} --script ${MDDEVICE} mklabel gpt - MDDEVICES="${MDDEVICES} ${MDDEVICE}" - done - - msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${MDDEVICES} - ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${MDDEVICES} || \ - (destroy_md_devices "${MDDEVICES}" && \ - destroy_loop_devices "${LODEVICES}" && exit 1) - - echo "$LODEVICES" >/tmp/zpool-lo.txt - echo "$MDDEVICES" >/tmp/zpool-md.txt -} - -zpool_destroy() { - msg ${ZPOOL} destroy ${ZPOOL_NAME} - ${ZPOOL} destroy ${ZPOOL_NAME} - destroy_md_devices "`cat /tmp/zpool-md.txt`" - destroy_loop_devices "`cat /tmp/zpool-lo.txt`" - - rm -f /tmp/zpool-md.txt /tmp/zpool-lo.txt -} diff --git a/scripts/zpool-config/lo-faulty-raid10.sh b/scripts/zpool-config/lo-faulty-raid10.sh deleted file mode 100644 index 1a523ec45..000000000 --- a/scripts/zpool-config/lo-faulty-raid10.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/bash -# -# 4 loopback devices using the md faulty level for easy -# fault injection on top of which is layered raid10 (mirrored). -# -# zpool-vdev0 zpool-vdev1 zpool-vdev2 zpool-vdev3 -# loop0 loop1 loop2 loop3 -# md0 (faulty) md1 (faulty) md2 (faulty) md3 (faulty) -# <--------------------- raid10 zpool ---------------------> -# - -FILEDIR=${FILEDIR:-/var/tmp} -FILES_M1=${FILES_M1:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1"} -FILES_M2=${FILES_M2:-"$FILEDIR/file-vdev2 $FILEDIR/file-vdev3"} -FILES="${FILES_M1} ${FILES_M2}" -LODEVICES="" -MDDEVICES="" -MDDEVICES_M1="" -MDDEVICES_M2="" - -zpool_create() { - local COUNT=0 - - check_loop_utils - check_md_utils - check_md_partitionable || die "Error non-partitionable md devices" - - for FILE in ${FILES}; do - LODEVICE=`unused_loop_device` - MDDEVICE=`unused_md_device` - let COUNT=${COUNT}+1 - - rm -f ${FILE} || exit 1 - dd if=/dev/zero of=${FILE} bs=1M count=0 seek=256 \ - &>/dev/null || die "Error $? creating ${FILE}" - - # Setup the loopback device on the file. - msg "Creating ${LODEVICE} using ${FILE}" - ${LOSETUP} ${LODEVICE} ${FILE} || \ - die "Error $? creating ${LODEVICE} using ${FILE}" - - LODEVICES="${LODEVICES} ${LODEVICE}" - - # Setup the md device on the loopback device. - msg "Creating ${MDDEVICE} using ${LODEVICE}" - ${MDADM} --build ${MDDEVICE} --level=faulty \ - --raid-devices=1 ${LODEVICE} &>/dev/null || \ - (destroy_md_devices "${MDDEVICES}" && \ - destroy_loop_devices "${LODEVICES}" && \ - die "Error $? creating ${MDDEVICE} using ${LODEVICE}") - wait_udev ${MDDEVICE} 30 || \ - (destroy_md_devices "${MDDEVICES}" && \ - destroy_loop_devices "${LODEVICES}" && \ - die "Error udev never created ${MDDEVICE}") - - # Create empty GPT/EFI partition table. - ${PARTED} --script ${MDDEVICE} mklabel gpt - MDDEVICES="${MDDEVICES} ${MDDEVICE}" - if [ $((COUNT % 2)) -eq 0 ]; then - MDDEVICES_M2="${MDDEVICES_M2} ${MDDEVICE}" - else - MDDEVICES_M1="${MDDEVICES_M1} ${MDDEVICE}" - fi - done - - msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} \ - mirror ${MDDEVICES_M1} mirror ${MDDEVICES_M2} - ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} \ - mirror ${MDDEVICES_M1} mirror ${MDDEVICES_M2} || \ - (destroy_md_devices "${MDDEVICES}" && \ - destroy_loop_devices "${LODEVICES}" && exit 1) - - echo "$LODEVICES" >/tmp/zpool-lo.txt - echo "$MDDEVICES" >/tmp/zpool-md.txt -} - -zpool_destroy() { - msg ${ZPOOL} destroy ${ZPOOL_NAME} - ${ZPOOL} destroy ${ZPOOL_NAME} - destroy_md_devices "`cat /tmp/zpool-md.txt`" - destroy_loop_devices "`cat /tmp/zpool-lo.txt`" - - rm -f /tmp/zpool-md.txt /tmp/zpool-lo.txt -} diff --git a/scripts/zpool-config/lo-faulty-raidz.sh b/scripts/zpool-config/lo-faulty-raidz.sh deleted file mode 100644 index c8f88b31f..000000000 --- a/scripts/zpool-config/lo-faulty-raidz.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash -# -# 4 loopback devices using the md faulty level for easy -# fault injection on top of which is layered raidz. -# -# zpool-vdev0 zpool-vdev1 zpool-vdev2 zpool-vdev3 -# loop0 loop1 loop2 loop3 -# md0 (faulty) md1 (faulty) md2 (faulty) md3 (faulty) -# <--------------------- raidz zpool ---------------------> -# - -FILEDIR=${FILEDIR:-/var/tmp} -FILES=${FILES:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1 \ - $FILEDIR/file-vdev2 $FILEDIR/file-vdev3"} -LODEVICES="" -MDDEVICES="" - -zpool_create() { - check_loop_utils - check_md_utils - check_md_partitionable || die "Error non-partitionable md devices" - - for FILE in ${FILES}; do - LODEVICE=`unused_loop_device` - MDDEVICE=`unused_md_device` - - rm -f ${FILE} || exit 1 - dd if=/dev/zero of=${FILE} bs=1M count=0 seek=256 \ - &>/dev/null || die "Error $? creating ${FILE}" - - # Setup the loopback device on the file. - msg "Creating ${LODEVICE} using ${FILE}" - ${LOSETUP} ${LODEVICE} ${FILE} || \ - die "Error $? creating ${LODEVICE} using ${FILE}" - - LODEVICES="${LODEVICES} ${LODEVICE}" - - # Setup the md device on the loopback device. - msg "Creating ${MDDEVICE} using ${LODEVICE}" - ${MDADM} --build ${MDDEVICE} --level=faulty \ - --raid-devices=1 ${LODEVICE} &>/dev/null || \ - (destroy_md_devices "${MDDEVICES}" && \ - destroy_loop_devices "${LODEVICES}" && \ - die "Error $? creating ${MDDEVICE} using ${LODEVICE}") - wait_udev ${MDDEVICE} 30 || \ - (destroy_md_devices "${MDDEVICES}" && \ - destroy_loop_devices "${LODEVICES}" && \ - die "Error udev never created ${MDDEVICE}") - - # Create empty GPT/EFI partition table. - ${PARTED} --script ${MDDEVICE} mklabel gpt - MDDEVICES="${MDDEVICES} ${MDDEVICE}" - done - - msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz ${MDDEVICES} - ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz ${MDDEVICES} || \ - (destroy_md_devices "${MDDEVICES}" && \ - destroy_loop_devices "${LODEVICES}" && exit 1) - - echo "$LODEVICES" >/tmp/zpool-lo.txt - echo "$MDDEVICES" >/tmp/zpool-md.txt -} - -zpool_destroy() { - msg ${ZPOOL} destroy ${ZPOOL_NAME} - ${ZPOOL} destroy ${ZPOOL_NAME} - destroy_md_devices "`cat /tmp/zpool-md.txt`" - destroy_loop_devices "`cat /tmp/zpool-lo.txt`" - - rm -f /tmp/zpool-md.txt /tmp/zpool-lo.txt -} diff --git a/scripts/zpool-config/lo-faulty-raidz2.sh b/scripts/zpool-config/lo-faulty-raidz2.sh deleted file mode 100644 index 85b7d463a..000000000 --- a/scripts/zpool-config/lo-faulty-raidz2.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash -# -# 4 loopback devices using the md faulty level for easy -# fault injection on top of which is layered raidz2. -# -# zpool-vdev0 zpool-vdev1 zpool-vdev2 zpool-vdev3 -# loop0 loop1 loop2 loop3 -# md0 (faulty) md1 (faulty) md2 (faulty) md3 (faulty) -# <--------------------- raidz2 zpool --------------------> -# - -FILEDIR=${FILEDIR:-/var/tmp} -FILES=${FILES:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1 \ - $FILEDIR/file-vdev2 $FILEDIR/file-vdev3"} -LODEVICES="" -MDDEVICES="" - -zpool_create() { - check_loop_utils - check_md_utils - check_md_partitionable || die "Error non-partitionable md devices" - - for FILE in ${FILES}; do - LODEVICE=`unused_loop_device` - MDDEVICE=`unused_md_device` - - rm -f ${FILE} || exit 1 - dd if=/dev/zero of=${FILE} bs=1M count=0 seek=256 \ - &>/dev/null || die "Error $? creating ${FILE}" - - # Setup the loopback device on the file. - msg "Creating ${LODEVICE} using ${FILE}" - ${LOSETUP} ${LODEVICE} ${FILE} || \ - die "Error $? creating ${LODEVICE} using ${FILE}" - - LODEVICES="${LODEVICES} ${LODEVICE}" - - # Setup the md device on the loopback device. - msg "Creating ${MDDEVICE} using ${LODEVICE}" - ${MDADM} --build ${MDDEVICE} --level=faulty \ - --raid-devices=1 ${LODEVICE} &>/dev/null || \ - (destroy_md_devices "${MDDEVICES}" && \ - destroy_loop_devices "${LODEVICES}" && \ - die "Error $? creating ${MDDEVICE} using ${LODEVICE}") - wait_udev ${MDDEVICE} 30 || \ - (destroy_md_devices "${MDDEVICES}" && \ - destroy_loop_devices "${LODEVICES}" && \ - die "Error udev never created ${MDDEVICE}") - - # Create empty GPT/EFI partition table. - ${PARTED} --script ${MDDEVICE} mklabel gpt - MDDEVICES="${MDDEVICES} ${MDDEVICE}" - done - - msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz2 ${MDDEVICES} - ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz2 ${MDDEVICES} || \ - (destroy_md_devices "${MDDEVICES}" && \ - destroy_loop_devices "${LODEVICES}" && exit 1) - - echo "$LODEVICES" >/tmp/zpool-lo.txt - echo "$MDDEVICES" >/tmp/zpool-md.txt -} - -zpool_destroy() { - msg ${ZPOOL} destroy ${ZPOOL_NAME} - ${ZPOOL} destroy ${ZPOOL_NAME} - destroy_md_devices "`cat /tmp/zpool-md.txt`" - destroy_loop_devices "`cat /tmp/zpool-lo.txt`" - - rm -f /tmp/zpool-md.txt /tmp/zpool-lo.txt -} diff --git a/scripts/zpool-config/lo-faulty-raidz3.sh b/scripts/zpool-config/lo-faulty-raidz3.sh deleted file mode 100644 index 7836b5f49..000000000 --- a/scripts/zpool-config/lo-faulty-raidz3.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash -# -# 4 loopback devices using the md faulty level for easy -# fault injection on top of which is layered raidz3. -# -# zpool-vdev0 zpool-vdev1 zpool-vdev2 zpool-vdev3 -# loop0 loop1 loop2 loop3 -# md0 (faulty) md1 (faulty) md2 (faulty) md3 (faulty) -# <--------------------- raidz3 zpool --------------------> -# - -FILES="/tmp/zpool-vdev0 \ - /tmp/zpool-vdev1 \ - /tmp/zpool-vdev2 \ - /tmp/zpool-vdev3" -LODEVICES="" -MDDEVICES="" - -zpool_create() { - check_loop_utils - check_md_utils - check_md_partitionable || die "Error non-partitionable md devices" - - for FILE in ${FILES}; do - LODEVICE=`unused_loop_device` - MDDEVICE=`unused_md_device` - - rm -f ${FILE} || exit 1 - dd if=/dev/zero of=${FILE} bs=1M count=0 seek=256 \ - &>/dev/null || die "Error $? creating ${FILE}" - - # Setup the loopback device on the file. - msg "Creating ${LODEVICE} using ${FILE}" - ${LOSETUP} ${LODEVICE} ${FILE} || \ - die "Error $? creating ${LODEVICE} using ${FILE}" - - LODEVICES="${LODEVICES} ${LODEVICE}" - - # Setup the md device on the loopback device. - msg "Creating ${MDDEVICE} using ${LODEVICE}" - ${MDADM} --build ${MDDEVICE} --level=faulty \ - --raid-devices=1 ${LODEVICE} &>/dev/null || \ - (destroy_md_devices "${MDDEVICES}" && \ - destroy_loop_devices "${LODEVICES}" && \ - die "Error $? creating ${MDDEVICE} using ${LODEVICE}") - wait_udev ${MDDEVICE} 30 || \ - (destroy_md_devices "${MDDEVICES}" && \ - destroy_loop_devices "${LODEVICES}" && \ - die "Error udev never created ${MDDEVICE}") - - # Create empty GPT/EFI partition table. - ${PARTED} --script ${MDDEVICE} mklabel gpt - MDDEVICES="${MDDEVICES} ${MDDEVICE}" - done - - msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz3 ${MDDEVICES} - ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz3 ${MDDEVICES} || \ - (destroy_md_devices "${MDDEVICES}" && \ - destroy_loop_devices "${LODEVICES}" && exit 1) - - echo "$LODEVICES" >/tmp/zpool-lo.txt - echo "$MDDEVICES" >/tmp/zpool-md.txt -} - -zpool_destroy() { - msg ${ZPOOL} destroy ${ZPOOL_NAME} - ${ZPOOL} destroy ${ZPOOL_NAME} - destroy_md_devices "`cat /tmp/zpool-md.txt`" - destroy_loop_devices "`cat /tmp/zpool-lo.txt`" - - rm -f /tmp/zpool-md.txt /tmp/zpool-lo.txt -} diff --git a/scripts/zpool-config/lo-raid0.sh b/scripts/zpool-config/lo-raid0.sh deleted file mode 100644 index 3f2cfe55e..000000000 --- a/scripts/zpool-config/lo-raid0.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -# -# 4 Device Loopback Raid-0 Configuration -# - -FILEDIR=${FILEDIR:-/var/tmp} -FILES=${FILES:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1 \ - $FILEDIR/file-vdev2 $FILEDIR/file-vdev3"} -DEVICES="" - -zpool_create() { - check_loop_utils - - for FILE in ${FILES}; do - DEVICE=`unused_loop_device` - msg "Creating ${FILE} using loopback device ${DEVICE}" - rm -f ${FILE} || exit 1 - dd if=/dev/zero of=${FILE} bs=1024k count=0 seek=256 \ - &>/dev/null || die "Error $? creating ${FILE}" - ${LOSETUP} ${DEVICE} ${FILE} || - die "Error $? creating ${FILE} -> ${DEVICE} loopback" - DEVICES="${DEVICES} ${DEVICE}" - done - - msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES} - ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES} || exit 1 -} - -zpool_destroy() { - msg ${ZPOOL} destroy ${ZPOOL_NAME} - ${ZPOOL} destroy ${ZPOOL_NAME} - - # Delay to ensure device is closed before removing loop device - sleep 1 - - for FILE in ${FILES}; do - DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:` - msg "Removing ${FILE} using loopback device ${DEVICE}" - ${LOSETUP} -d ${DEVICE} || - die "Error $? destroying ${FILE} -> ${DEVICE} loopback" - rm -f ${FILE} || exit 1 - done -} diff --git a/scripts/zpool-config/lo-raid10.sh b/scripts/zpool-config/lo-raid10.sh deleted file mode 100644 index 580ed1fb7..000000000 --- a/scripts/zpool-config/lo-raid10.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash -# -# 4 Device Loopback Raid-0 Configuration -# - -FILEDIR=${FILEDIR:-/var/tmp} -FILES_M1=${FILES_M1:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1"} -FILES_M2=${FILES_M2:-"$FILEDIR/file-vdev2 $FILEDIR/file-vdev3"} -FILES="${FILES_M1} ${FILES_M2}" -DEVICES_M1="" -DEVICES_M2="" - -zpool_create() { - check_loop_utils - - for FILE in ${FILES_M1}; do - DEVICE=`unused_loop_device` - msg "Creating ${FILE} using loopback device ${DEVICE}" - rm -f ${FILE} || exit 1 - dd if=/dev/zero of=${FILE} bs=1024k count=0 seek=256 \ - &>/dev/null || die "Error $? creating ${FILE}" - ${LOSETUP} ${DEVICE} ${FILE} || - die "Error $? creating ${FILE} -> ${DEVICE} loopback" - DEVICES_M1="${DEVICES_M1} ${DEVICE}" - done - - for FILE in ${FILES_M2}; do - DEVICE=`unused_loop_device` - msg "Creating ${FILE} using loopback device ${DEVICE}" - rm -f ${FILE} || exit 1 - dd if=/dev/zero of=${FILE} bs=1024k count=0 seek=256 \ - &>/dev/null || die "Error $? creating ${FILE}" - ${LOSETUP} ${DEVICE} ${FILE} || - die "Error $? creating ${FILE} -> ${DEVICE} loopback" - DEVICES_M2="${DEVICES_M2} ${DEVICE}" - done - - msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} \ - mirror ${DEVICES_M1} mirror ${DEVICES_M2} - ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} \ - mirror ${DEVICES_M1} mirror ${DEVICES_M2} -} - -zpool_destroy() { - msg ${ZPOOL} destroy ${ZPOOL_NAME} - ${ZPOOL} destroy ${ZPOOL_NAME} - - # Delay to ensure device is closed before removing loop device - sleep 1 - - for FILE in ${FILES}; do - DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:` - msg "Removing ${FILE} using loopback device ${DEVICE}" - ${LOSETUP} -d ${DEVICE} || - die "Error $? destroying ${FILE} -> ${DEVICE} loopback" - rm -f ${FILE} || exit 1 - done -} diff --git a/scripts/zpool-config/lo-raidz.sh b/scripts/zpool-config/lo-raidz.sh deleted file mode 100644 index 90b26c591..000000000 --- a/scripts/zpool-config/lo-raidz.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# -# 4 Device Loopback Raid-0 Configuration -# -FILEDIR=${FILEDIR:-/var/tmp} -FILES=${FILES:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1 \ - $FILEDIR/file-vdev2 $FILEDIR/file-vdev3"} -DEVICES="" - -zpool_create() { - check_loop_utils - - for FILE in ${FILES}; do - DEVICE=`unused_loop_device` - msg "Creating ${FILE} using loopback device ${DEVICE}" - rm -f ${FILE} || exit 1 - dd if=/dev/zero of=${FILE} bs=1024k count=0 seek=256 \ - &>/dev/null || die "Error $? creating ${FILE}" - ${LOSETUP} ${DEVICE} ${FILE} || - die "Error $? creating ${FILE} -> ${DEVICE} loopback" - DEVICES="${DEVICES} ${DEVICE}" - done - - msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz ${DEVICES} - ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz ${DEVICES} || exit 1 -} - -zpool_destroy() { - msg ${ZPOOL} destroy ${ZPOOL_NAME} - ${ZPOOL} destroy ${ZPOOL_NAME} - - # Delay to ensure device is closed before removing loop device - sleep 1 - - for FILE in ${FILES}; do - DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:` - msg "Removing ${FILE} using loopback device ${DEVICE}" - ${LOSETUP} -d ${DEVICE} || - die "Error $? destroying ${FILE} -> ${DEVICE} loopback" - rm -f ${FILE} || exit 1 - done -} diff --git a/scripts/zpool-config/lo-raidz2.sh b/scripts/zpool-config/lo-raidz2.sh deleted file mode 100644 index 9e58b2a17..000000000 --- a/scripts/zpool-config/lo-raidz2.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -# -# 4 Device Loopback Raid-0 Configuration -# - -FILEDIR=${FILEDIR:-/var/tmp} -FILES=${FILES:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1 \ - $FILEDIR/file-vdev2 $FILEDIR/file-vdev3"} -DEVICES="" - -zpool_create() { - check_loop_utils - - for FILE in ${FILES}; do - DEVICE=`unused_loop_device` - msg "Creating ${FILE} using loopback device ${DEVICE}" - rm -f ${FILE} || exit 1 - dd if=/dev/zero of=${FILE} bs=1024k count=0 seek=256 \ - &>/dev/null || die "Error $? creating ${FILE}" - ${LOSETUP} ${DEVICE} ${FILE} || - die "Error $? creating ${FILE} -> ${DEVICE} loopback" - DEVICES="${DEVICES} ${DEVICE}" - done - - msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz2 ${DEVICES} - ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz2 ${DEVICES} || exit 1 -} - -zpool_destroy() { - msg ${ZPOOL} destroy ${ZPOOL_NAME} - ${ZPOOL} destroy ${ZPOOL_NAME} - - # Delay to ensure device is closed before removing loop device - sleep 1 - - for FILE in ${FILES}; do - DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:` - msg "Removing ${FILE} using loopback device ${DEVICE}" - ${LOSETUP} -d ${DEVICE} || - die "Error $? destroying ${FILE} -> ${DEVICE} loopback" - rm -f ${FILE} || exit 1 - done -} diff --git a/scripts/zpool-config/md0-raid10.sh b/scripts/zpool-config/md0-raid10.sh deleted file mode 100644 index 65cae6a26..000000000 --- a/scripts/zpool-config/md0-raid10.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# -# Four disk Raid-10 in a single Raid-0 Configuration -# - -MDADM=${MDADM:-/sbin/mdadm} -MDDEVICES=${MDDEVICES:-"/dev/sd[abcd]"} -MDCOUNT=${MDCOUNT:-4} -MDRAID=${MDRAID:-10} - -DEVICES="/dev/md0" - -zpool_md_destroy() { - msg ${MDADM} --manage --stop ${DEVICES} - ${MDADM} --manage --stop ${DEVICES} &>/dev/null - - msg ${MDADM} --zero-superblock ${MDDEVICES} - ${MDADM} --zero-superblock ${MDDEVICES} >/dev/null -} - -zpool_create() { - msg ${MDADM} --create ${DEVICES} --level=${MDRAID} \ - --raid-devices=${MDCOUNT} ${MDDEVICES} - ${MDADM} --create ${DEVICES} --level=${MDRAID} \ - --raid-devices=${MDCOUNT} ${MDDEVICES} \ - &>/dev/null || (zpool_md_destroy && exit 1) - - msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES} - ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} \ - ${DEVICES} || (zpool_md_destroy && exit 2) -} - -zpool_destroy() { - msg ${ZPOOL} destroy ${ZPOOL_NAME} - ${ZPOOL} destroy ${ZPOOL_NAME} - - zpool_md_destroy -} diff --git a/scripts/zpool-config/md0-raid5.sh b/scripts/zpool-config/md0-raid5.sh deleted file mode 100644 index 373034bd3..000000000 --- a/scripts/zpool-config/md0-raid5.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# -# Four disk Raid-5 in a single Raid-0 Configuration -# - -MDADM=${MDADM:-/sbin/mdadm} -MDDEVICES=${MDDEVICES:-"/dev/sd[abcd]"} -MDCOUNT=${MDCOUNT:-4} -MDRAID=${MDRAID:-5} - -DEVICES="/dev/md0" - -zpool_md_destroy() { - msg ${MDADM} --manage --stop ${DEVICES} - ${MDADM} --manage --stop ${DEVICES} &>/dev/null - - msg ${MDADM} --zero-superblock ${MDDEVICES} - ${MDADM} --zero-superblock ${MDDEVICES} >/dev/null -} - -zpool_create() { - msg ${MDADM} --create ${DEVICES} --level=${MDRAID} \ - --raid-devices=${MDCOUNT} ${MDDEVICES} - ${MDADM} --create ${DEVICES} --level=${MDRAID} \ - --raid-devices=${MDCOUNT} ${MDDEVICES} \ - &>/dev/null || (zpool_md_destroy && exit 1) - - msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES} - ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} \ - ${DEVICES} || (zpool_md_destroy && exit 2) -} - -zpool_destroy() { - msg ${ZPOOL} destroy ${ZPOOL_NAME} - ${ZPOOL} destroy ${ZPOOL_NAME} - - zpool_md_destroy -} diff --git a/scripts/zpool-config/ram0-raid0.sh b/scripts/zpool-config/ram0-raid0.sh deleted file mode 100644 index 801c912ca..000000000 --- a/scripts/zpool-config/ram0-raid0.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# -# Single ram disk /dev/ram0 Raid-0 Configuration -# - -DEVICES="/dev/ram0" - -zpool_create() { - msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES} - ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES} || exit 1 -} - -zpool_destroy() { - msg ${ZPOOL} destroy ${ZPOOL_NAME} - ${ZPOOL} destroy ${ZPOOL_NAME} || exit 1 -} diff --git a/scripts/zpool-config/scsi_debug-noraid.sh b/scripts/zpool-config/scsi_debug-noraid.sh deleted file mode 100644 index c508ffbf1..000000000 --- a/scripts/zpool-config/scsi_debug-noraid.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -# -# 1 scsi_debug devices on top of which is layered no raid. -# - -SDSIZE=${SDSIZE:-128} -SDHOSTS=${SDHOSTS:-1} -SDTGTS=${SDTGTS:-1} -SDLUNS=${SDLUNS:-1} -LDMOD=/sbin/modprobe - -zpool_create() { - check_sd_utils - - test `${LSMOD} | grep -c scsi_debug` -gt 0 && \ - (echo 0 >/sys/module/scsi_debug/parameters/every_nth && \ - ${RMMOD} scsi_debug || exit 1) - udev_trigger - - msg "${LDMOD} scsi_debug dev_size_mb=${SDSIZE} " \ - "add_host=${SDHOSTS} num_tgts=${SDTGTS} " \ - "max_luns=${SDLUNS}" - ${LDMOD} scsi_debug \ - dev_size_mb=${SDSIZE} \ - add_host=${SDHOSTS} \ - num_tgts=${SDTGTS} \ - max_luns=${SDLUNS} || \ - die "Error $? creating scsi_debug devices" - udev_trigger - SDDEVICE=`${LSSCSI}|${AWK} '/scsi_debug/ { print $6; exit }'` - - msg "${PARTED} -s ${SDDEVICE} mklabel gpt" - ${PARTED} -s ${SDDEVICE} mklabel gpt || \ - (${RMMOD} scsi_debug && die "Error $? creating gpt label") - - msg "${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${SDDEVICE}" - ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${SDDEVICE} || \ - (${RMMOD} scsi_debug && exit 1) -} - -zpool_destroy() { - msg ${ZPOOL} destroy ${ZPOOL_NAME} - ${ZPOOL} destroy ${ZPOOL_NAME} - msg "${RMMOD} scsi_debug" - ${RMMOD} scsi_debug || die "Error $? removing scsi_debug devices" -} diff --git a/scripts/zpool-config/scsi_debug-raid0.sh b/scripts/zpool-config/scsi_debug-raid0.sh deleted file mode 100644 index 66720852b..000000000 --- a/scripts/zpool-config/scsi_debug-raid0.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/bash -# -# 1 scsi_debug device for fault injection and 3 loopback devices -# on top of which is layered raid0 (striped). -# - -SDSIZE=${SDSIZE:-256} -SDHOSTS=${SDHOSTS:-1} -SDTGTS=${SDTGTS:-1} -SDLUNS=${SDLUNS:-1} -LDMOD=/sbin/modprobe -FILEDIR=${FILEDIR:-/var/tmp} -FILES=${FILES:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1 $FILEDIR/file-vdev2"} -DEVICES="" - -zpool_create() { - check_loop_utils - check_sd_utils - - test `${LSMOD} | grep -c scsi_debug` -gt 0 && \ - (echo 0 >/sys/module/scsi_debug/parameters/every_nth && \ - ${RMMOD} scsi_debug || exit 1) - udev_trigger - - msg "${LDMOD} scsi_debug dev_size_mb=${SDSIZE} " \ - "add_host=${SDHOSTS} num_tgts=${SDTGTS} " \ - "max_luns=${SDLUNS}" - ${LDMOD} scsi_debug \ - dev_size_mb=${SDSIZE} \ - add_host=${SDHOSTS} \ - num_tgts=${SDTGTS} \ - max_luns=${SDLUNS} || \ - die "Error $? creating scsi_debug devices" - udev_trigger - - SDDEVICE=`${LSSCSI} | ${AWK} '/scsi_debug/ { print $6; exit }'` - msg "${PARTED} -s ${SDDEVICE} mklabel gpt" - ${PARTED} -s ${SDDEVICE} mklabel gpt || \ - (${RMMOD} scsi_debug && die "Error $? creating gpt label") - - for FILE in ${FILES}; do - LODEVICE=`unused_loop_device` - - rm -f ${FILE} || exit 1 - dd if=/dev/zero of=${FILE} bs=1024k count=0 seek=256 \ - &>/dev/null || (${RMMOD} scsi_debug && \ - die "Error $? creating ${FILE}") - - # Setup the loopback device on the file. - msg "Creating ${LODEVICE} using ${FILE}" - ${LOSETUP} ${LODEVICE} ${FILE} || (${RMMOD} scsi_debug \ - die "Error $? creating ${LODEVICE} using ${FILE}") - - DEVICES="${DEVICES} ${LODEVICE}" - done - - DEVICES="${DEVICES} ${SDDEVICE}" - - msg "${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES}" - ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES} || \ - (${RMMOD} scsi_debug && exit 1) -} - -zpool_destroy() { - msg ${ZPOOL} destroy ${ZPOOL_NAME} - ${ZPOOL} destroy ${ZPOOL_NAME} - - for FILE in ${FILES}; do - LODEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:` - msg "Removing ${LODEVICE} using ${FILE}" - ${LOSETUP} -d ${LODEVICE} || - die "Error $? destroying ${LODEVICE} using ${FILE}" - rm -f ${FILE} || exit 1 - done - - msg "${RMMOD} scsi_debug" - ${RMMOD} scsi_debug || die "Error $? removing scsi_debug devices" -} diff --git a/scripts/zpool-config/scsi_debug-raid10.sh b/scripts/zpool-config/scsi_debug-raid10.sh deleted file mode 100644 index caff1a0f6..000000000 --- a/scripts/zpool-config/scsi_debug-raid10.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/bash -# -# 1 scsi_debug device for fault injection and 3 loopback devices -# on top of which is layered raid10 (mirrored). -# - -SDSIZE=${SDSIZE:-256} -SDHOSTS=${SDHOSTS:-1} -SDTGTS=${SDTGTS:-1} -SDLUNS=${SDLUNS:-1} -LDMOD=/sbin/modprobe -FILEDIR=${FILEDIR:-/var/tmp} -FILES=${FILES:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1 $FILEDIR/file-vdev2"} -DEVICES_M1="" -DEVICES_M2="" - -zpool_create() { - local COUNT=0 - - check_loop_utils - check_sd_utils - - test `${LSMOD} | grep -c scsi_debug` -gt 0 && \ - (echo 0 >/sys/module/scsi_debug/parameters/every_nth && \ - ${RMMOD} scsi_debug || exit 1) - udev_trigger - - msg "${LDMOD} scsi_debug dev_size_mb=${SDSIZE} " \ - "add_host=${SDHOSTS} num_tgts=${SDTGTS} " \ - "max_luns=${SDLUNS}" - ${LDMOD} scsi_debug \ - dev_size_mb=${SDSIZE} \ - add_host=${SDHOSTS} \ - num_tgts=${SDTGTS} \ - max_luns=${SDLUNS} || \ - die "Error $? creating scsi_debug devices" - udev_trigger - SDDEVICE=`${LSSCSI}|${AWK} '/scsi_debug/ { print $6; exit }'` - msg "${PARTED} -s ${SDDEVICE} mklabel gpt" - ${PARTED} -s ${SDDEVICE} mklabel gpt || \ - (${RMMOD} scsi_debug && die "Error $? creating gpt label") - - for FILE in ${FILES}; do - LODEVICE=`unused_loop_device` - - rm -f ${FILE} || exit 1 - dd if=/dev/zero of=${FILE} bs=1024k count=0 seek=256 \ - &>/dev/null || (${RMMOD} scsi_debug && \ - die "Error $? creating ${FILE}") - - # Setup the loopback device on the file. - msg "Creating ${LODEVICE} using ${FILE}" - ${LOSETUP} ${LODEVICE} ${FILE} || (${RMMOD} scsi_debug \ - die "Error $? creating ${LODEVICE} using ${FILE}") - - DEVICES="${DEVICES} ${LODEVICE}" - done - - DEVICES="${DEVICES} ${SDDEVICE}" - - for DEVICE in ${DEVICES}; do - let COUNT=${COUNT}+1 - - if [ $((COUNT % 2)) -eq 0 ]; then - DEVICES_M2="${DEVICES_M2} ${DEVICE}" - else - DEVICES_M1="${DEVICES_M1} ${DEVICE}" - fi - done - - msg "${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} " \ - "mirror ${DEVICES_M1} mirror ${DEVICES_M2}" - ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} \ - mirror ${DEVICES_M1} mirror ${DEVICES_M2} || \ - (${RMMOD} scsi_debug && exit 1) -} - -zpool_destroy() { - msg ${ZPOOL} destroy ${ZPOOL_NAME} - ${ZPOOL} destroy ${ZPOOL_NAME} - - for FILE in ${FILES}; do - LODEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:` - msg "Removing ${LODEVICE} using ${FILE}" - ${LOSETUP} -d ${LODEVICE} || - die "Error $? destroying ${LODEVICE} using ${FILE}" - rm -f ${FILE} || exit 1 - done - - msg "${RMMOD} scsi_debug" - ${RMMOD} scsi_debug || die "Error $? removing scsi_debug devices" -} diff --git a/scripts/zpool-config/scsi_debug-raidz.sh b/scripts/zpool-config/scsi_debug-raidz.sh deleted file mode 100644 index bc22d1004..000000000 --- a/scripts/zpool-config/scsi_debug-raidz.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/bash -# -# 1 scsi_debug device for fault injection and 3 loopback devices -# on top of which is layered raidz. -# - -SDSIZE=${SDSIZE:-256} -SDHOSTS=${SDHOSTS:-1} -SDTGTS=${SDTGTS:-1} -SDLUNS=${SDLUNS:-1} -LDMOD=/sbin/modprobe -FILEDIR=${FILEDIR:-/var/tmp} -FILES=${FILES:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1 $FILEDIR/file-vdev2"} -DEVICES="" - -zpool_create() { - check_loop_utils - check_sd_utils - - test `${LSMOD} | grep -c scsi_debug` -gt 0 && \ - (echo 0 >/sys/module/scsi_debug/parameters/every_nth && \ - ${RMMOD} scsi_debug || exit 1) - udev_trigger - - msg "${LDMOD} scsi_debug dev_size_mb=${SDSIZE} " \ - "add_host=${SDHOSTS} num_tgts=${SDTGTS} " \ - "max_luns=${SDLUNS}" - ${LDMOD} scsi_debug \ - dev_size_mb=${SDSIZE} \ - add_host=${SDHOSTS} \ - num_tgts=${SDTGTS} \ - max_luns=${SDLUNS} || \ - die "Error $? creating scsi_debug devices" - udev_trigger - - SDDEVICE=`${LSSCSI} | ${AWK} '/scsi_debug/ { print $6; exit }'` - msg "${PARTED} -s ${SDDEVICE} mklabel gpt" - ${PARTED} -s ${SDDEVICE} mklabel gpt || \ - (${RMMOD} scsi_debug && die "Error $? creating gpt label") - - for FILE in ${FILES}; do - LODEVICE=`unused_loop_device` - - rm -f ${FILE} || exit 1 - dd if=/dev/zero of=${FILE} bs=1024k count=0 seek=256 \ - &>/dev/null || (${RMMOD} scsi_debug && \ - die "Error $? creating ${FILE}") - - # Setup the loopback device on the file. - msg "Creating ${LODEVICE} using ${FILE}" - ${LOSETUP} ${LODEVICE} ${FILE} || (${RMMOD} scsi_debug \ - die "Error $? creating ${LODEVICE} using ${FILE}") - - DEVICES="${DEVICES} ${LODEVICE}" - done - - DEVICES="${DEVICES} ${SDDEVICE}" - - msg "${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz ${DEVICES}" - ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz ${DEVICES} || \ - (${RMMOD} scsi_debug && exit 1) -} - -zpool_destroy() { - msg ${ZPOOL} destroy ${ZPOOL_NAME} - ${ZPOOL} destroy ${ZPOOL_NAME} - - for FILE in ${FILES}; do - LODEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:` - msg "Removing ${LODEVICE} using ${FILE}" - ${LOSETUP} -d ${LODEVICE} || - die "Error $? destroying ${LODEVICE} using ${FILE}" - rm -f ${FILE} || exit 1 - done - - msg "${RMMOD} scsi_debug" - ${RMMOD} scsi_debug || die "Error $? removing scsi_debug devices" -} diff --git a/scripts/zpool-config/scsi_debug-raidz2.sh b/scripts/zpool-config/scsi_debug-raidz2.sh deleted file mode 100644 index 67a6f243a..000000000 --- a/scripts/zpool-config/scsi_debug-raidz2.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/bash -# -# 1 scsi_debug device for fault injection and 3 loopback devices -# on top of which is layered raidz2. -# - -SDSIZE=${SDSIZE:-256} -SDHOSTS=${SDHOSTS:-1} -SDTGTS=${SDTGTS:-1} -SDLUNS=${SDLUNS:-1} -LDMOD=/sbin/modprobe -FILEDIR=${FILEDIR:-/var/tmp} -FILES=${FILES:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1 $FILEDIR/file-vdev2"} -DEVICES="" - -zpool_create() { - check_loop_utils - check_sd_utils - - test `${LSMOD} | grep -c scsi_debug` -gt 0 && \ - (echo 0 >/sys/module/scsi_debug/parameters/every_nth && \ - ${RMMOD} scsi_debug || exit 1) - udev_trigger - - msg "${LDMOD} scsi_debug dev_size_mb=${SDSIZE} " \ - "add_host=${SDHOSTS} num_tgts=${SDTGTS} " \ - "max_luns=${SDLUNS}" - ${LDMOD} scsi_debug \ - dev_size_mb=${SDSIZE} \ - add_host=${SDHOSTS} \ - num_tgts=${SDTGTS} \ - max_luns=${SDLUNS} || \ - die "Error $? creating scsi_debug devices" - udev_trigger - - SDDEVICE=`${LSSCSI} | ${AWK} '/scsi_debug/ { print $6; exit }'` - msg "${PARTED} -s ${SDDEVICE} mklabel gpt" - ${PARTED} -s ${SDDEVICE} mklabel gpt || \ - (${RMMOD} scsi_debug && die "Error $? creating gpt label") - - for FILE in ${FILES}; do - LODEVICE=`unused_loop_device` - - rm -f ${FILE} || exit 1 - dd if=/dev/zero of=${FILE} bs=1024k count=0 seek=256 \ - &>/dev/null || (${RMMOD} scsi_debug && \ - die "Error $? creating ${FILE}") - - # Setup the loopback device on the file. - msg "Creating ${LODEVICE} using ${FILE}" - ${LOSETUP} ${LODEVICE} ${FILE} || (${RMMOD} scsi_debug \ - die "Error $? creating ${LODEVICE} using ${FILE}") - - DEVICES="${DEVICES} ${LODEVICE}" - done - - DEVICES="${DEVICES} ${SDDEVICE}" - - msg "${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz2 ${DEVICES}" - ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz2 ${DEVICES} || \ - (${RMMOD} scsi_debug && exit 1) -} - -zpool_destroy() { - msg ${ZPOOL} destroy ${ZPOOL_NAME} - ${ZPOOL} destroy ${ZPOOL_NAME} - - for FILE in ${FILES}; do - LODEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:` - msg "Removing ${LODEVICE} using ${FILE}" - ${LOSETUP} -d ${LODEVICE} || - die "Error $? destroying ${LODEVICE} using ${FILE}" - rm -f ${FILE} || exit 1 - done - - msg "${RMMOD} scsi_debug" - ${RMMOD} scsi_debug || die "Error $? removing scsi_debug devices" -} diff --git a/scripts/zpool-config/scsi_debug-raidz3.sh b/scripts/zpool-config/scsi_debug-raidz3.sh deleted file mode 100644 index d7ef2098e..000000000 --- a/scripts/zpool-config/scsi_debug-raidz3.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/bash -# -# 1 scsi_debug device for fault injection and 3 loopback devices -# on top of which is layered raidz3. -# - -SDSIZE=${SDSIZE:-256} -SDHOSTS=${SDHOSTS:-1} -SDTGTS=${SDTGTS:-1} -SDLUNS=${SDLUNS:-1} -LDMOD=/sbin/modprobe -FILES="/tmp/zpool-vdev0 \ - /tmp/zpool-vdev1 \ - /tmp/zpool-vdev2" -DEVICES="" - -zpool_create() { - check_loop_utils - check_sd_utils - - test `${LSMOD} | grep -c scsi_debug` -gt 0 && \ - (echo 0 >/sys/module/scsi_debug/parameters/every_nth && \ - ${RMMOD} scsi_debug || exit 1) - udev_trigger - - msg "${LDMOD} scsi_debug dev_size_mb=${SDSIZE} " \ - "add_host=${SDHOSTS} num_tgts=${SDTGTS} " \ - "max_luns=${SDLUNS}" - ${LDMOD} scsi_debug \ - dev_size_mb=${SDSIZE} \ - add_host=${SDHOSTS} \ - num_tgts=${SDTGTS} \ - max_luns=${SDLUNS} || \ - die "Error $? creating scsi_debug devices" - udev_trigger - - SDDEVICE=`${LSSCSI} | ${AWK} '/scsi_debug/ { print $6; exit }'` - msg "${PARTED} -s ${SDDEVICE} mklabel gpt" - ${PARTED} -s ${SDDEVICE} mklabel gpt || \ - (${RMMOD} scsi_debug && die "Error $? creating gpt label") - - for FILE in ${FILES}; do - LODEVICE=`unused_loop_device` - - rm -f ${FILE} || exit 1 - dd if=/dev/zero of=${FILE} bs=1024k count=0 seek=256 \ - &>/dev/null || (${RMMOD} scsi_debug && \ - die "Error $? creating ${FILE}") - - # Setup the loopback device on the file. - msg "Creating ${LODEVICE} using ${FILE}" - ${LOSETUP} ${LODEVICE} ${FILE} || (${RMMOD} scsi_debug \ - die "Error $? creating ${LODEVICE} using ${FILE}") - - DEVICES="${DEVICES} ${LODEVICE}" - done - - DEVICES="${DEVICES} ${SDDEVICE}" - - msg "${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz3 ${DEVICES}" - ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} raidz3 ${DEVICES} || \ - (${RMMOD} scsi_debug && exit 1) -} - -zpool_destroy() { - msg ${ZPOOL} destroy ${ZPOOL_NAME} - ${ZPOOL} destroy ${ZPOOL_NAME} - - for FILE in ${FILES}; do - LODEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:` - msg "Removing ${LODEVICE} using ${FILE}" - ${LOSETUP} -d ${LODEVICE} || - die "Error $? destroying ${LODEVICE} using ${FILE}" - rm -f ${FILE} || exit 1 - done - - msg "${RMMOD} scsi_debug" - ${RMMOD} scsi_debug || die "Error $? removing scsi_debug devices" -} diff --git a/scripts/zpool-config/sda-raid0.sh b/scripts/zpool-config/sda-raid0.sh deleted file mode 100644 index 48dc96d27..000000000 --- a/scripts/zpool-config/sda-raid0.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# -# Single disk /dev/sda Raid-0 Configuration -# - -DEVICES="/dev/sda" - -zpool_create() { - msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES} - ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${DEVICES} || exit 1 -} - -zpool_destroy() { - msg ${ZPOOL} destroy ${ZPOOL_NAME} - ${ZPOOL} destroy ${ZPOOL_NAME} || exit 1 -} diff --git a/scripts/zpool-config/zpool-raid0.sh b/scripts/zpool-config/zpool-raid0.sh deleted file mode 100644 index c75775588..000000000 --- a/scripts/zpool-config/zpool-raid0.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash -# -# Zpool Raid-0 Configuration -# -# This script is used to test with the /dev/disk/by-vdev/[A-Z][1-n] devices. -# It assumes that you have already populated /dev/disk/by-vdev/ by creating -# an /etc/zfs/vdev_id.conf file based on your system design. -# -# You can then use either the zpool-create.sh or the zpios.sh test script to -# test various Raid-0 configurations by adjusting the following tunables. -# For example if you wanted to create and test a single 4-disk Raid-0 -# configuration using disks [A-D]1 with dedicated ZIL and L2ARC devices -# you could run the following. -# -# ZIL="log A2" L2ARC="cache B2" RANKS=1 CHANNELS=4 \ -# zpool-create.sh -c zpool-raid0 -# -# zpool status tank -# pool: tank -# state: ONLINE -# scan: none requested -# config: -# -# NAME STATE READ WRITE CKSUM -# tank ONLINE 0 0 0 -# A1 ONLINE 0 0 0 -# B1 ONLINE 0 0 0 -# C1 ONLINE 0 0 0 -# D1 ONLINE 0 0 0 -# logs -# A2 ONLINE 0 0 0 -# cache -# B2 ONLINE 0 0 0 -# -# errors: No known data errors -# - -# Number of interior vdevs to create using the following rank ids. -RANKS=${RANKS:-1} -RANK_LIST=( 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ) - -# Number of devices per vdev using the following channel ids. -CHANNELS=${CHANNELS:-8} -CHANNEL_LIST=( A B C D E F G H I J K L M N O P Q R S T U V W X Y Z ) - -# Create a ZIL vdev as follows. -ZIL=${ZIL:-} - -# Create an L2ARC vdev as follows. -L2ARC=${L2ARC:-} - - -raid0_setup() { - local RANKS=$1 - local CHANNELS=$2 - - RAID0S=() - for (( i=0, k=0; i<${RANKS}; i++ )); do - RANK=${RANK_LIST[$i]} - - for (( j=0; j<${CHANNELS}; j++, k++ )); do - RAID0S[${k}]="${CHANNEL_LIST[$j]}${RANK}" - done - done - - return 0 -} - -zpool_create() { - raid0_setup ${RANKS} ${CHANNELS} - - ZPOOL_DEVICES="${RAID0S[*]} ${ZIL} ${L2ARC}" - msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${ZPOOL_DEVICES} - ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${ZPOOL_DEVICES} || exit 1 -} - -zpool_destroy() { - msg ${ZPOOL} destroy ${ZPOOL_NAME} - ${ZPOOL} destroy ${ZPOOL_NAME} -} diff --git a/scripts/zpool-config/zpool-raid10.sh b/scripts/zpool-config/zpool-raid10.sh deleted file mode 100644 index d71c4d366..000000000 --- a/scripts/zpool-config/zpool-raid10.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/bash -# -# Zpool Raid-10 Configuration -# -# This script is used to test with the /dev/disk/by-vdev/[A-Z][1-n] devices. -# It assumes that you have already populated /dev/disk/by-vdev/ by creating -# an /etc/zfs/vdev_id.conf file based on your system design. -# -# You can then use either the zpool-create.sh or the zpios.sh test script to -# test various Raid-10 configurations by adjusting the following tunables. -# For example if you wanted to create and test a single 4-disk Raid-10 -# configuration using disks [A-D]1 with dedicated ZIL and L2ARC devices -# you could run the following. -# -# ZIL="log A2" L2ARC="cache B2" RANKS=1 CHANNELS=4 \ -# zpool-create.sh -c zpool-raid10 -# -# zpool status tank -# pool: tank -# state: ONLINE -# scan: none requested -# config: -# -# NAME STATE READ WRITE CKSUM -# tank ONLINE 0 0 0 -# mirror-0 ONLINE 0 0 0 -# A1 ONLINE 0 0 0 -# B1 ONLINE 0 0 0 -# mirror-1 ONLINE 0 0 0 -# C1 ONLINE 0 0 0 -# D1 ONLINE 0 0 0 -# logs -# A2 ONLINE 0 0 0 -# cache -# B2 ONLINE 0 0 0 -# -# errors: No known data errors -# - -# Number of interior vdevs to create using the following rank ids. -RANKS=${RANKS:-1} -RANK_LIST=( 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ) - -# Number of devices per vdev using the following channel ids. -CHANNELS=${CHANNELS:-8} -CHANNEL_LIST=( A B C D E F G H I J K L M N O P Q R S T U V W X Y Z ) - -# Create a ZIL vdev as follows. -ZIL=${ZIL:-} - -# Create an L2ARC vdev as follows. -L2ARC=${L2ARC:-} - - -raid10_setup() { - local RANKS=$1 - local CHANNELS=$2 - local IDX=0 - - RAID10S=() - for (( i=0, l=0 ; i<${RANKS}; i++ )); do - RANK=${RANK_LIST[$i]} - - for (( j=0, k=1; j<${CHANNELS}; j+=2,k+=2,l++ )); do - DISK1="${CHANNEL_LIST[$j]}${RANK}" - DISK2="${CHANNEL_LIST[$k]}${RANK}" - RAID10S[$l]="mirror ${DISK1} ${DISK2}" - done - done - - return 0 -} - -zpool_create() { - raid10_setup ${RANKS} ${CHANNELS} - - ZPOOL_DEVICES="${RAID10S[*]} ${ZIL} ${L2ARC}" - msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${ZPOOL_DEVICES} - ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${ZPOOL_DEVICES} || exit 1 -} - -zpool_destroy() { - msg ${ZPOOL} destroy ${ZPOOL_NAME} - ${ZPOOL} destroy ${ZPOOL_NAME} -} diff --git a/scripts/zpool-config/zpool-raidz.sh b/scripts/zpool-config/zpool-raidz.sh deleted file mode 100644 index b3f21a003..000000000 --- a/scripts/zpool-config/zpool-raidz.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/bash -# -# Zpool Raid-Z Configuration -# -# This script is used to test with the /dev/disk/by-vdev/[A-Z][1-n] devices. -# It assumes that you have already populated /dev/disk/by-vdev/ by creating -# an /etc/zfs/vdev_id.conf file based on your system design. -# -# You can then use either the zpool-create.sh or the zpios.sh test script to -# test various Raid-Z configurations by adjusting the following tunables. -# For example if you wanted to create and test a single 4-disk Raid-Z2 -# configuration using disks [A-D]1 with dedicated ZIL and L2ARC devices -# you could run the following. -# -# ZIL="log A2" L2ARC="cache B2" RANKS=1 CHANNELS=4 LEVEL=2 \ -# zpool-create.sh -c zpool-raidz -# -# zpool status tank -# pool: tank -# state: ONLINE -# scan: none requested -# config: -# -# NAME STATE READ WRITE CKSUM -# tank ONLINE 0 0 0 -# raidz2-0 ONLINE 0 0 0 -# A1 ONLINE 0 0 0 -# B1 ONLINE 0 0 0 -# C1 ONLINE 0 0 0 -# D1 ONLINE 0 0 0 -# logs -# A2 ONLINE 0 0 0 -# cache -# B2 ONLINE 0 0 0 -# -# errors: No known data errors -# - -# Number of interior vdevs to create using the following rank ids. -RANKS=${RANKS:-1} -RANK_LIST=( 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ) - -# Number of devices per vdev using the following channel ids. -CHANNELS=${CHANNELS:-8} -CHANNEL_LIST=( A B C D E F G H I J K L M N O P Q R S T U V W X Y Z ) - -# Raid-Z Level: 1, 2, or 3. -LEVEL=${LEVEL:-2} - -# Create a ZIL vdev as follows. -ZIL=${ZIL:-} - -# Create an L2ARC vdev as follows. -L2ARC=${L2ARC:-} - - -raidz_setup() { - local RANKS=$1 - local CHANNELS=$2 - - RAIDZS=() - for (( i=0; i<${RANKS}; i++ )); do - RANK=${RANK_LIST[$i]} - RAIDZ=("raidz${LEVEL}") - - for (( j=0, k=1; j<${CHANNELS}; j++, k++ )); do - RAIDZ[$k]="${CHANNEL_LIST[$j]}${RANK}" - done - - RAIDZS[$i]="${RAIDZ[*]}" - done - - return 0 -} - -zpool_create() { - raidz_setup ${RANKS} ${CHANNELS} - - ZPOOL_DEVICES="${RAIDZS[*]} ${ZIL} ${L2ARC}" - msg ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${ZPOOL_DEVICES} - ${ZPOOL} create ${ZPOOL_FLAGS} ${ZPOOL_NAME} ${ZPOOL_DEVICES} || exit 1 -} - -zpool_destroy() { - msg ${ZPOOL} destroy ${ZPOOL_NAME} - ${ZPOOL} destroy ${ZPOOL_NAME} -} |