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