Last active
August 29, 2015 14:25
-
-
Save ksingh7/150fd0c9929e09613ff1 to your computer and use it in GitHub Desktop.
DD test for Spinning and SSD disk
This file contains 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
## Change these variables for your environment | |
SPINNING_DISK_OUTPUT_FILE_PATH= | |
SSD_DISK_OUTPUT_FILE_PATH= | |
COUNT=262000 | |
BLOCK_SIZE=4k | |
############## | |
TEMP_FILE=/dev/zero | |
> /tmp/dd_output ; | |
for i in 1 2 3 4 ; do | |
> /tmp/bench_out_$i; | |
done | |
if [ -n "$SPINNING_DISK_OUTPUT_FILE_PATH" ] | |
then | |
for i in 1 2 3 4 ; do | |
echo 3 > /proc/sys/vm/drop_caches ; | |
dd if=$TEMP_FILE of=$SPINNING_DISK_OUTPUT_FILE_PATH bs=$BLOCK_SIZE count=$COUNT oflag=direct,dsync 2>> /tmp/bench_out_1 ; | |
done | |
fi | |
if [ -n "$SSD_DISK_OUTPUT_FILE_PATH" ] | |
then | |
for i in 1 2 3 4 ; do | |
echo 3 > /proc/sys/vm/drop_caches ; | |
dd if=$TEMP_FILE of=$SSD_DISK_OUTPUT_FILE_PATH bs=$BLOCK_SIZE count=$COUNT oflag=direct,dsync 2>> /tmp/bench_out_2 ; | |
done | |
fi | |
if [ -n "$SPINNING_DISK_OUTPUT_FILE_PATH" ] | |
then | |
for i in 1 2 3 4 ; do | |
dd if=$TEMP_FILE of=$SPINNING_DISK_OUTPUT_FILE_PATH bs=$BLOCK_SIZE count=$COUNT 2>> /tmp/bench_out_3 ; | |
done | |
fi | |
if [ -n "$SSD_DISK_OUTPUT_FILE_PATH" ] | |
then | |
for i in 1 2 3 4 ; do | |
dd if=$TEMP_FILE of=$SSD_DISK_OUTPUT_FILE_PATH bs=$BLOCK_SIZE count=$COUNT 2>> /tmp/bench_out_4 ; | |
done | |
fi | |
if [ -z "$SPINNING_DISK_OUTPUT_FILE_PATH" ] && [ -z "$SSD_DISK_OUTPUT_FILE_PATH" ] | |
then | |
echo "DISK_OUTPUT_FILE_PATH has not been set in this script " | |
exit 1 | |
fi | |
echo "dd output for Spinning Disk with kernel cache dropped and direct + synchronous write" >> /tmp/dd_output | |
grep -i copied /tmp/bench_out_1 | cut -d ' ' -f 8-9 >> /tmp/dd_output | |
echo " " >> /tmp/dd_output | |
echo "dd output for Spinning Disk with kernel cache default (ON) , dd cached writes" >> /tmp/dd_output | |
grep -i copied /tmp/bench_out_3 | cut -d ' ' -f 8-9 >> /tmp/dd_output | |
echo " " >> /tmp/dd_output | |
echo "dd output for SSD Disk with kernel cache dropped and direct + synchronous write" >> /tmp/dd_output | |
grep -i copied /tmp/bench_out_2 | cut -d ' ' -f 8-9 >> /tmp/dd_output | |
echo " " >> /tmp/dd_output | |
echo "dd output for SSD Disk with kernel cache default (ON), dd cached writes" >> /tmp/dd_output | |
grep -i copied /tmp/bench_out_4 | cut -d ' ' -f 8-9 >> /tmp/dd_output | |
echo " " >> /tmp/dd_output | |
cat /tmp/dd_output | |
#rm -f $TEMP_FILE | |
#rm -f $SPINNING_DISK_OUTPUT_FILE_PATH; | |
#rm -f $SSD_DISK_OUTPUT_FILE_PATH; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment