#!/bin/sh #author:reed #blog:luweikai.blog.51cto.com #说明:使用自带的dd命令 file=dd.file BS_COUNT_8K=(8K 12K) BS_COUNT_64K=(64K 6K) BS_COUNT_1M=(1M 1K) list="8K 64K 1M" wlog=/tmp/ddwrite.log rlog=/tmp/ddread.log #write Write() { echo "[INFO]WRITE" for i in $list;do bs=$(eval echo \$\{BS_COUNT_$i\[0\]\}) count=$(eval echo \$\{BS_COUNT_$i\[1\]\}) echo "dd if=/dev/zero of=$file conv=fsync oflag=direct bs=$bs count=$count" dd if=/dev/zero of=$file conv=fsync oflag=direct bs=$bs count=$count 2>>$wlog echo " " #echo "sleep 3" sleep 3 done } #read Read() { echo "[INFO]READ" for i in $list;do bs=$(eval echo \$\{BS_COUNT_$i\[0\]\}) count=$(eval echo \$\{BS_COUNT_$i\[1\]\}) echo "dd if=$file of=/dev/null iflag=direct bs=$bs count=$count" dd if=$file of=/dev/null iflag=direct bs=$bs count=$count 2>> $rlog echo " " #echo "sleep 3" sleep 3 done } Write|tee -a $wlog echo "please wait 5 seconds......" sleep 5 Read|tee -a $rlog
本文出自 “[reed@卢伟开~]#rm -rf /” 博客,请务必保留此出处http://luweikai.blog.51cto.com/1705672/1547114
原文地址:http://luweikai.blog.51cto.com/1705672/1547114