summaryrefslogtreecommitdiffstats
path: root/scripts/zpool-config/zpool-raid10.sh
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2010-11-05 11:43:20 -0700
committerBrian Behlendorf <[email protected]>2010-11-08 14:03:36 -0800
commitcb39a6c6aa91531a641232e7d0c6a4d63836b0cc (patch)
treefb01b741b6d481bcc1e185de39d6c19ee40444e7 /scripts/zpool-config/zpool-raid10.sh
parent3ee56c292bbcd7e6b26e3c2ad8f0e50eee236bcc (diff)
Replace custom zpool configs with generic configs
To streamline testing I have in the past added several custom configs to the zpool-config directory. This change reverts those custom configs and replaces them with three generic config which can do the same thing. The generic config behavior can be set by setting various environment variables when calling either the zpool-create.sh or zpios.sh scripts. 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
Diffstat (limited to 'scripts/zpool-config/zpool-raid10.sh')
-rw-r--r--scripts/zpool-config/zpool-raid10.sh86
1 files changed, 86 insertions, 0 deletions
diff --git a/scripts/zpool-config/zpool-raid10.sh b/scripts/zpool-config/zpool-raid10.sh
new file mode 100644
index 000000000..8cb1f1548
--- /dev/null
+++ b/scripts/zpool-config/zpool-raid10.sh
@@ -0,0 +1,86 @@
+#!/bin/bash
+#
+# Zpool Raid-10 Configuration
+#
+# This script is used to simplify testing with the /dev/disk/zpool/[A-Z][1-n]
+# devices. It assumes that you have already populated /dev/disk/zpool/ by
+# creating an /etc/zfs/zdev.conf file based on your system design. You may
+# use the zpool_layout command or manually create your own config file.
+#
+# 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 ${FORCE_FLAG} ${ZPOOL_NAME} ${ZPOOL_DEVICES}
+ ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${ZPOOL_DEVICES} || exit 1
+}
+
+zpool_destroy() {
+ msg ${ZPOOL} destroy ${ZPOOL_NAME}
+ ${ZPOOL} destroy ${ZPOOL_NAME}
+}