Last active
February 22, 2018 06:37
-
-
Save lotherk/4550d6144f58ec1de43d29c04223d112 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
init_mirror="/dev/da3 /dev/da4" | |
mirrors="da5:da6 da7:da8 da9:da11 da12:da13 da14:da15" | |
zils="da2:da10" | |
zil_size="8g" | |
zfs_pool="tank" | |
out_file="/root/bonnie.csv" | |
bonnie_dir="/tank/bonnie" | |
bonnie_user="temp" | |
run_bonnie() { | |
mkdir -p $bonnie_dir | |
chown $bonnie_user $bonnie_dir | |
bonnie++ -d $bonnie_dir -n 0 -m "$1" -f -b -u $bonnie_user >> $out_file | |
} | |
benchmark() { | |
prefix=$1 | |
counter=1 | |
for m in $mirrors; do | |
disk_a=$(echo $m |awk -F ':' '{print $1}') | |
disk_b=$(echo $m |awk -F ':' '{print $2}') | |
zpool add -f tank mirror /dev/${disk_a} /dev/${disk_b} | |
run_bonnie "${prefix}.test.${counter}" | |
counter=$(let $counter + 1) | |
done | |
} | |
doit() { | |
zil=$1 | |
echo "destroying ${zfs_pool}" | |
zpool destroy $zfs_pool | |
echo "creating ${zfs_pool}" | |
zpool create -f ${zfs_pool} mirror ${init_mirror} || exit $? | |
if [ -z $zil ] || [ $zil -eq 0 ]; then | |
prefix="no-zil" | |
else | |
prefix="zil" | |
zil_a=$(echo $zils |awk -F ':' '{print $1}') | |
zil_b=$(echo $zils |awk -F ':' '{print $2}') | |
gpart destroy -F $zil_a | |
gpart destroy -F $zil_b | |
gpart create -s gpt $zil_a | |
gpart create -s gpt $zil_b | |
gpart add -t freebsd-zfs -s $zil_size $zil_a | |
gpart add -t freebsd-zfs -s $zil_size $zil_b | |
zpool add $zfs_pool log mirror /dev/${zil_a}p1 /dev/${zil_b}p1 | |
fi | |
echo "[$prefix] Running initial test" | |
run_bonnie "${prefix}.test.0" | |
benchmark $prefix | |
} | |
echo > $out_file | |
doit 0 # no zil | |
doit 1 # with zil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment