]>
Commit | Line | Data |
---|---|---|
cb39a6c6 BB |
1 | #!/bin/bash |
2 | # | |
3 | # Zpool Raid-0 Configuration | |
4 | # | |
5 | # This script is used to simplify testing with the /dev/disk/zpool/[A-Z][1-n] | |
6 | # devices. It assumes that you have already populated /dev/disk/zpool/ by | |
7 | # creating an /etc/zfs/zdev.conf file based on your system design. You may | |
8 | # use the zpool_layout command or manually create your own config file. | |
9 | # | |
10 | # You can then use either the zpool-create.sh or the zpios.sh test script to | |
11 | # test various Raid-0 configurations by adjusting the following tunables. | |
12 | # For example if you wanted to create and test a single 4-disk Raid-0 | |
13 | # configuration using disks [A-D]1 with dedicated ZIL and L2ARC devices | |
14 | # you could run the following. | |
15 | # | |
16 | # ZIL="log A2" L2ARC="cache B2" RANKS=1 CHANNELS=4 \ | |
17 | # zpool-create.sh -c zpool-raid0 | |
18 | # | |
19 | # zpool status tank | |
20 | # pool: tank | |
21 | # state: ONLINE | |
22 | # scan: none requested | |
23 | # config: | |
24 | # | |
25 | # NAME STATE READ WRITE CKSUM | |
26 | # tank ONLINE 0 0 0 | |
27 | # A1 ONLINE 0 0 0 | |
28 | # B1 ONLINE 0 0 0 | |
29 | # C1 ONLINE 0 0 0 | |
30 | # D1 ONLINE 0 0 0 | |
31 | # logs | |
32 | # A2 ONLINE 0 0 0 | |
33 | # cache | |
34 | # B2 ONLINE 0 0 0 | |
35 | # | |
36 | # errors: No known data errors | |
37 | # | |
38 | ||
39 | # Number of interior vdevs to create using the following rank ids. | |
40 | RANKS=${RANKS:-1} | |
41 | RANK_LIST=( 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ) | |
42 | ||
43 | # Number of devices per vdev using the following channel ids. | |
44 | CHANNELS=${CHANNELS:-8} | |
45 | 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 ) | |
46 | ||
47 | # Create a ZIL vdev as follows. | |
48 | ZIL=${ZIL:-} | |
49 | ||
50 | # Create an L2ARC vdev as follows. | |
51 | L2ARC=${L2ARC:-} | |
52 | ||
53 | ||
54 | raid0_setup() { | |
55 | local RANKS=$1 | |
56 | local CHANNELS=$2 | |
57 | ||
58 | RAID0S=() | |
59 | for (( i=0, k=0; i<${RANKS}; i++ )); do | |
60 | RANK=${RANK_LIST[$i]} | |
61 | ||
62 | for (( j=0; j<${CHANNELS}; j++, k++ )); do | |
63 | RAID0S[${k}]="${CHANNEL_LIST[$j]}${RANK}" | |
64 | done | |
65 | done | |
66 | ||
67 | return 0 | |
68 | } | |
69 | ||
70 | zpool_create() { | |
71 | raid0_setup ${RANKS} ${CHANNELS} | |
72 | ||
73 | ZPOOL_DEVICES="${RAID0S[*]} ${ZIL} ${L2ARC}" | |
74 | msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${ZPOOL_DEVICES} | |
75 | ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${ZPOOL_DEVICES} || exit 1 | |
76 | } | |
77 | ||
78 | zpool_destroy() { | |
79 | msg ${ZPOOL} destroy ${ZPOOL_NAME} | |
80 | ${ZPOOL} destroy ${ZPOOL_NAME} | |
81 | } |