hacks/fsn1.disktest/disktest.sh

157 lines
2.9 KiB
Bash
Raw Normal View History

2020-02-25 15:10:47 +00:00
#!/bin/bash
set -x
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
2020-03-09 15:20:42 +00:00
POOLNAME="tank"
2020-02-25 15:10:47 +00:00
MPT="/srv/z"
2020-03-09 15:20:42 +00:00
JOBFILE="/tmp/jobfile.fio"
KEYLOC="/tmp/testkey.raw"
function main() {
show_system_info
prep_system
do_direct_tests
do_zfs_tests
}
function do_direct_tests() {
trim_disks
for DISK in $FULLPATHS; do
print_divider
echo "testing $DISK"
for NJ in 1 16; do
for BS in 64k ; do
cat > $JOBFILE <<EOF
[test-${BS}chunk-${NJ}thread]
bs=$BS
filename=$DISK
iodepth=64
ioengine=libaio
readwrite=readwrite
numjobs=$NJ
size=$(expr 10000 / $NJ)M
runtime=60
time_based=1
group_reporting=1
EOF
cat $JOBFILE
fio $FO $JOBFILE 2>&1
done
done
done
}
2020-02-25 15:10:47 +00:00
2020-03-09 15:20:42 +00:00
function print_divider() {
echo '##############################################################'
echo '##############################################################'
}
2020-02-25 15:10:47 +00:00
2020-03-09 15:20:42 +00:00
function trim_disks() {
2020-02-25 15:10:47 +00:00
for DISK in $FULLPATHS ; do
blkdiscard $DISK
2020-03-09 15:20:42 +00:00
nvme format -r $DISK
2020-02-25 15:10:47 +00:00
done
2020-03-09 15:20:42 +00:00
print_divider
echo "################## waiting 60s for nvme format to complete..."
sleep 60
nvme list
}
function show_system_info() {
print_divider
date -u
lsb_release -a
uname -a
lsblk -t
nvme list
modinfo zfs | grep -iw version
modinfo spl | grep -iw version
zfs version
print_divider
}
function prep_system() {
killall fio || true
sleep 1
if [[ -e $MPT/.zfs ]]; then
zpool destroy $POOLNAME
fi
}
function do_zfs_tests() {
for ASHIFTVAL in 12 13 14 15 16 ; do
trim_disks
print_divider
zpool create $POOLNAME \
-o ashift=$ASHIFTVAL -O mountpoint=$MPT \
raidz1 $FULLPATHS
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 $POOLNAME/none
# compressed
zfs create $COMP $POOLNAME/comp
# encrypted
zfs create $ENC $POOLNAME/enc
# compressed and encrypted
zfs create $COMP $ENC $POOLNAME/both
FO="--eta-newline=10 --eta-interval=10 --eta=always"
for NJ in 1 16 ; do
for BS in 64k ; do
for DIRNAME in none comp enc both ; do
cat > $JOBFILE <<EOF
[test-$DIRNAME-${BS}chunk-${NJ}thread-ashift${ASHIFTVAL}]
2020-02-25 15:10:47 +00:00
bs=$BS
directory=$MPT/$DIRNAME/
iodepth=64
ioengine=libaio
readwrite=readwrite
numjobs=$NJ
nrfiles=$NJ
2020-03-09 15:20:42 +00:00
size=10000M
runtime=120
2020-02-25 15:10:47 +00:00
time_based=1
group_reporting=1
EOF
2020-03-09 15:20:42 +00:00
cat $JOBFILE
fio $FO $JOBFILE 2>&1
rm -rf $MPT/$DIRNAME/*
done
2020-02-25 15:10:47 +00:00
done
done
2020-03-09 15:20:42 +00:00
zpool destroy $POOLNAME
done
}
2020-02-25 15:10:47 +00:00
2020-03-09 15:20:42 +00:00
main