hacks/fsn1.disktest/disktest.sh

91 lines
1.5 KiB
Bash
Raw Normal View History

2020-02-25 15:10:47 +00:00
#!/bin/bash
set -x
set -e
date -u
zfs version
killall fio || true
sleep 1
RAWDISKS=$(
cd /dev/disk/by-id ;
ls -1 nvme-SAMSUNG* | grep -v part
)
FULLPATHS=""
for RAWDISK in $RAWDISKS ; do
FULLPATHS+=" /dev/disk/by-id/$RAWDISK"
done
PN="tank"
MPT="/srv/z"
if [[ -e $MPT/.zfs ]]; then
zpool destroy $PN
fi
lsblk -t
for ASHIFTVAL in 12 13 14 15 16 ; do
for DISK in $FULLPATHS ; do
blkdiscard $DISK
nvme format $DISK
done
zpool create $PN \
-o ashift=$ASHIFTVAL -O mountpoint=$MPT \
raidz1 $FULLPATHS
KEYLOC="/tmp/testkey.raw"
dd if=/dev/urandom of=$KEYLOC bs=32 count=1
COMP="-o compression=lz4"
ENC="-o encryption=aes-256-gcm -o keyformat=raw -o keylocation=file://$KEYLOC"
# plain
zfs create $PN/none
# compressed
zfs create $COMP $PN/comp
# encrypted
zfs create $ENC $PN/enc
# compressed and encrypted
zfs create $COMP $ENC $PN/both
FO="--eta-newline=10 --eta-interval=10 --eta=always"
JF="/tmp/jobfile.fio"
rm -f $JF
for NJ in 1 8 32 ; do
for BS in 64k 1M ; do
for DIRNAME in none comp enc both ; do
# 400000M comes from ~1.5x machine's ram size: 256G
cat >> $JF <<EOF
[test-$DIRNAME-${BS}chunk-${NJ}thread]
bs=$BS
directory=$MPT/$DIRNAME/
iodepth=64
ioengine=libaio
readwrite=readwrite
numjobs=$NJ
nrfiles=$NJ
size=$(expr 400000 / $NJ)M
runtime=300
time_based=1
group_reporting=1
EOF
done
done
done
cat $JF
fio $FO $JF
zpool destroy $PN
done