Last active
December 22, 2015 16:59
-
-
Save harshavardhana/6502979 to your computer and use it in GitHub Desktop.
Tar read test on Gluster NFS volume
This file contains hidden or 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/bash | |
_init() | |
{ | |
DIRZ=$( seq 1 100 ) | |
} | |
cleanup() | |
{ | |
echo "Cleaning the test" | |
if [ -f /tmp/tar_read_errors.txt ]; then | |
rm -f /tmp/tar_read_errors.txt; | |
fi | |
for dir in $DIRZ | |
do | |
rm -fr $dir | |
rm -fr ${dir}.tar | |
done | |
} | |
samples() | |
{ | |
echo "Creating samples" | |
# create dirs | |
for dir in $DIRZ | |
do | |
[ -f $dir/afile ] && continue | |
mkdir $dir | |
if [ "$1" == "sync" ]; then | |
dd if=/dev/urandom of=$dir/afile bs=4096 count=10 oflag=sync >/dev/null 2>&1 | |
else | |
dd if=/dev/urandom of=$dir/afile bs=4096 count=10 >/dev/null 2>&1 | |
fi | |
done | |
} | |
readtest(){ | |
echo "Performing read test" | |
# do the tars | |
for dir in $DIRZ | |
do | |
tar cf ${dir}.tar $dir 2>>/tmp/tar_read_errors.txt | |
done | |
} | |
main() | |
{ | |
cleanup; | |
if [ "$1" == "sync" ]; then | |
echo "O_SYNC is turned on" | |
samples $1; | |
readtest; | |
count=`wc -l /tmp/tar_read_errors.txt` | |
elif [ "$1" == "flush" ]; then | |
echo "Flushing filesystem buffers"; | |
samples; | |
sync; | |
readtest; | |
count=`wc -l /tmp/tar_read_errors.txt` | |
else | |
samples; | |
readtest; | |
count=`wc -l /tmp/tar_read_errors.txt` | |
fi | |
echo "Total read failures ${count}" | |
} | |
_init "$@" && main "$@" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment