sequential FIO test

This commit is contained in:
Sandino Araico Sanchez 2017-02-02 17:40:49 -06:00
parent fbdf448efa
commit 3501bb9a69

86
scripts/test-fio-sequential Executable file
View file

@ -0,0 +1,86 @@
#!/bin/bash
if [[ -z $OUTPUT_DIR ]] ; then
source scan-dmidecode
fi
source test-variables
scan-hdd # Always rescan
echo -n "BEGIN: " >> $OUTPUT_DIR/fio-seq.log
date >> $OUTPUT_DIR/fio-seq.log
for DISK in `cat $OUTPUT_DIR/disk.lst \
| sed 's/#.*$//' \
| cut -d ':' -f 1`
do
SERIAL=`cat $OUTPUT_DIR/disk.lst \
| grep $DISK \
| cut -d ':' -f 2`
echo -n "Testing disk $DISK with fio ..."
#wrapper-fio $DISK $SERIAL $JOBS &
BLK_SIZE=`cat /sys/block/$DISK/queue/physical_block_size`
cat > $OUTPUT_DIR/disk/$DISK.seq.job << EOF
[global]
ioengine=libaio
#direct=1
gtod_reduce=1
bs=$BLK_SIZE
iodepth=64
# TODO: Uncomment for production
size=15G
# TODO: Debug variable. Comment out for production
#size=16M
#rw=randrw
rw=readwrite
rwmixread=95
directory=/mnt/$DISK
[file1]
name=test1
filename=test1
EOF
BEGIN=`date +%s`
# Reset partition table to zero
dd if=/dev/zero of=/dev/${DISK} bs=$BLK_SIZE count=128 \
>> /run/$SERIAL.fio-seq.out 2>&1
parted /dev/${DISK} mklabel gpt mkpart primary 1 128G \
>> /run/$SERIAL.fio-seq.out 2>&1
sleep 1
if [[ ! -b /dev/${DISK}1 ]] ; then
echo "Device /dev/${DISK}1 is not a block special file"
exit 17
fi
mkfs.ext4 /dev/${DISK}1 \
>> /run/$SERIAL.fio-seq.out 2>&1
mkdir -pv /mnt/${DISK}
mount /dev/${DISK}1 /mnt/${DISK}
MOUNTED=`cat /proc/mounts | grep ${DISK}1`
if [[ -z $MOUNTED ]] ; then
echo "Device /dev/${DISK}1 is not mounted"
exit 18
fi
fio --output $OUTPUT_DIR/disk/$SERIAL.fio-seq.out \
$OUTPUT_DIR/disk/$DISK.seq.job
umount -f /mnt/${DISK}
# Reset partition table to zero
dd if=/dev/zero of=/dev/${DISK} bs=$BLK_SIZE count=128 \
>> /run/$SERIAL.fio-seq.out 2>&1
END=`date +%s`
DURATION=$(( END - BEGIN ))
echo $DURATION
done
echo -n "END: " >> $OUTPUT_DIR/fio-seq.log
date >> $OUTPUT_DIR/fio-seq.log
echo >> $OUTPUT_DIR/fio-seq.log
#snapshot
mkdir -p $SNAPSHOT_D
cp -af $OUTPUT_DIR/* $SNAPSHOT_D/