順便寫了一個簡單的shell script做測試。
of:檔案要存放的位置
//做1G
dd if=/dev/zero of=/tmp/1gb count=1024 bs=1M
//做10G
dd if=/dev/zero of=/tmp/10gb count=10240 bs=1M
//做100G
dd if=/dev/zero of=/tmp/100gb count=102400 bs=1M
//做100G
dd if=/dev/zero of=/tmp/100gb count=100 bs=1G
包裝成shell script使用
目前先都將產生的檔案產生在tmp的目錄下
dummy_path="/tmp/"
count=$1
block_size=$2
block_count=$3
if [ -z "$count" ] || [ -z "$block_size"] || [ -z "$block_count"]
then
echo "Please input paramters for creating dummy file"
else
for ((index=0;index<$count;index++))
do
#echo "file index: $index"
now=$(date +"%m-%d-%Y-%H-%M-%S")
filename="dummyfile_no_${index}_${now}"
echo "create dummy file($index):$filename"
dd if=/dev/zero of="$dummy_path/$filename" count=$block_count bs=$block_size
done
fi
exit 0
$>./dummy_creator 10 1M 1024 # 產生十個1G的檔案
沒有留言:
張貼留言
留個話吧:)