summaryrefslogtreecommitdiffstats
path: root/scripts/zpool-config/dragon-raidz2-15x8.sh
blob: cc3800e7b4f0d771bb5ee7b97a3ad59eaa451434 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
#
# Dragon (White Box) Raid-Z2 Configuration (15x8 stripes)
#

DEVICES_A=(`ls /dev/disk/by-path/* | grep pci-0000\:03 | head -15`)
DEVICES_B=(`ls /dev/disk/by-path/* | grep pci-0000\:03 | tail -15`)
DEVICES_C=(`ls /dev/disk/by-path/* | grep pci-0000\:04 | head -15`)
DEVICES_D=(`ls /dev/disk/by-path/* | grep pci-0000\:04 | tail -15`)
DEVICES_E=(`ls /dev/disk/by-path/* | grep pci-0000\:83 | head -15`)
DEVICES_F=(`ls /dev/disk/by-path/* | grep pci-0000\:83 | tail -15`)
DEVICES_G=(`ls /dev/disk/by-path/* | grep pci-0000\:84 | head -15`)
DEVICES_H=(`ls /dev/disk/by-path/* | grep pci-0000\:84 | tail -15`)

DEVICES_PER_CTRL=1
RAIDZ2_GROUPS=15
RAIDZ2S=()
Z_IDX=0

zpool_create() {
	D_IDX=0
	for i in `seq 1 ${RAIDZ2_GROUPS}`; do
		RAIDZ2=""
		for IDX in `seq 1 ${DEVICES_PER_CTRL}`; do
			RAIDZ2="${RAIDZ2} `readlink -f ${DEVICES_A[${D_IDX}]}`"
			RAIDZ2="${RAIDZ2} `readlink -f ${DEVICES_B[${D_IDX}]}`"
			RAIDZ2="${RAIDZ2} `readlink -f ${DEVICES_C[${D_IDX}]}`"
			RAIDZ2="${RAIDZ2} `readlink -f ${DEVICES_D[${D_IDX}]}`"
			RAIDZ2="${RAIDZ2} `readlink -f ${DEVICES_E[${D_IDX}]}`"
			RAIDZ2="${RAIDZ2} `readlink -f ${DEVICES_F[${D_IDX}]}`"
			RAIDZ2="${RAIDZ2} `readlink -f ${DEVICES_G[${D_IDX}]}`"
			RAIDZ2="${RAIDZ2} `readlink -f ${DEVICES_H[${D_IDX}]}`"
			let D_IDX=D_IDX+1
		done
		RAIDZ2S[${Z_IDX}]="raidz2 ${RAIDZ2}"
		let Z_IDX=Z_IDX+1
	done

	msg ${ZPOOL} create -f ${ZPOOL_NAME} ${RAIDZ2S[*]}
	${ZPOOL} create -f ${ZPOOL_NAME} ${RAIDZ2S[*]} || exit 1
}

zpool_destroy() {
	msg ${ZPOOL} destroy ${ZPOOL_NAME}
	${ZPOOL} destroy ${ZPOOL_NAME}
}