Board logo

標題: 硬碟I/O測試指令 [打印本頁]

作者: service.support    時間: 2010-9-30 15:20     標題: 硬碟I/O測試指令

Disk I/O 測試指令:

請將下面內容貼入 io-test.sh 檔案中!!
Loop --> 執行 10萬次
Count --> DD一百次1MB大小, 產生 100MB 的檔案
兩次之間休息2秒

#!/bin/bash

logfile='/tmp/io-test.log';
loop=100000
count=100
bs=1M
sleep=2

if [ -f $logfile ]; then
        rm -rf $logfile
fi

for ((i=0; i<=$loop; i=$i+1 ))
do
                rm -rf /var/lib/mysql/dd-test-WRITE
                rm -rf /var/lib/mysql/dd-test-WRITE1
                echo "===============================================================";
                echo "[$i] Perform the WRITE test..... [bs=$bs count=$count]";
                date >> $logfile;
                dd if=/dev/zero of=/var/lib/mysql/dd-test-WRITE bs=$bs count=$count 2>> $logfile;
                sync; sleep $sleep;

                echo "[$i] Perform the READ test.....  [bs=$bs count=$count]";
                dd if=/var/lib/mysql/dd-test-WRITE of=/dev/null bs=$bs count=$count 2>> $logfile;
                sync; sleep $sleep;

                echo "[$i] Perform the READ-WRITE test..... [bs=$bs count=$count]";
                dd if=/var/lib/mysql/dd-test-WRITE of=/var/lib/mysql/dd-test-WRITE1 bs=$bs count=$count 2> $logfile;
                sync; sleep $sleep;
                date >> $logfile;
done




歡迎光臨 HGIGA Service Docs (http://docs.hgiga.com/Discuz4/) Powered by Discuz! 4.1.0