Skip to content

Instantly share code, notes, and snippets.

@alram
Created March 5, 2019 21:02
Show Gist options
  • Save alram/7870e408b43a40759774945032dd9c77 to your computer and use it in GitHub Desktop.
Save alram/7870e408b43a40759774945032dd9c77 to your computer and use it in GitHub Desktop.
#!/bin/bash
#set -x
FIO_RESULT_DIR="/home/amarangone/fio_results"
FIO_COMMON_OPTIONS="--ioengine=libaio --direct=1 --runtime=300 --iodepth=32"
for i in `ls /sys/block/ | grep ^sd `; do
#we don't want to bench a HDD with a partition table
ls /sys/block/${i}/sd* > /dev/null 2>&1
if [ $? -ne 0 ]; then
hdds+=($i)
fi
done
echo drive list ${hdds[@]}
# runs single tests (stresses hdds)
for hdd in ${hdds[@]}; do
#for each drive, test 4k, 128k, 1m BS
#randread, randwrite, read, write. Each test 5min
#Total: 5*3*4 = 1h/HDD -> 45h
for bs in 4k 128k 1024k; do
for rw in randwrite write randread read; do
echo "running test: ${bs} - ${rw} - ${hdd}"
fio --rw=${rw} --bs=${bs} ${FIO_COMMON_OPTIONS} --filename=/dev/${hdd} --output=${FIO_RESULT_DIR}/single_${rw}_${bs}_${hdd}.txt --name single_${rw}_${bs}_${hdd}
done
done
done
# runs concurrent tests (stresses controller)
for bs in 4k 128k 1024k; do
for rw in randwrite write randread read; do
for hdd in ${hdds[@]}; do
fio --rw=${rw} --bs=${bs} ${FIO_COMMON_OPTIONS} --filename=/dev/${hdd} --output=${FIO_RESULT_DIR}/concurrent_${rw}_${bs}_${hdd}.txt --name single_${rw}_${bs}_${hdd} &
done
wait
echo next batch
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment