shell通过fio工具进行磁盘性能测试 |
您所在的位置:网站首页 › 磁盘读写检测方法有哪些 › shell通过fio工具进行磁盘性能测试 |
一、环境准备(已安装fio工具可忽略此步骤) 准备一台centos服务器,要求能够访问互联网,安装fio工具。 yum -y install fio fio --version 二、脚本内容 直接复制脚本到自己的主机中,我这里命名为fio.sh。 #!/bin/bash echo "开始磁盘性能测试,请确保安装fio工具,等待中..." #顺序读 fio -filename=/var/test.file -direct=1 -iodepth 1 -thread -rw=read -ioengine=psync -bs=16k -size=2G -numjobs=10 -runtime=60 -group_reporting -name=test_r > fio READ=$(awk '$0~"'READ:'"{print $2 $3 $6 $7}' fio) echo "顺序读 $READ" #顺序写 fio -filename=/var/test.file -direct=1 -iodepth 1 -thread -rw=write -ioengine=psync -bs=16k -size=2G -numjobs=10 -runtime=60 -group_reporting -name=test_w > fio WRITE=$(awk '$0~"'WRITE:'"{print $2 $3 $6 $7}' fio) echo "顺序写 $WRITE" #随机读 fio -filename=/var/test.file -direct=1 -iodepth 1 -thread -rw=randread -ioengine=psync -bs=16k -size=2G -numjobs=10 -runtime=60 -group_reporting -name=test_randr > fio RANDR=$(awk '$0~"'READ:'"{print $2 $3 $6 $7}' fio) echo "随机读 $RANDR" #随机写 fio -filename=/var/test.file -direct=1 -iodepth 1 -thread -rw=randwrite -ioengine=psync -bs=16k -size=2G -numjobs=10 -runtime=60 -group_reporting -name=test_randw > fio RANDW=$(awk '$0~"'WRITE:'"{print $2 $3 $6 $7}' fio) echo "随机写 $RANDW" #顺序读写 fio -filename=/var/test.file -direct=1 -iodepth 1 -thread -rw=rw -rwmixread=70 -ioengine=psync -bs=16k -size=2G -numjobs=10 -runtime=60 -group_reporting -name=test_r_w -ioscheduler=noop > fio R1=$(awk '$0~"'READ:'"{print $2 $3 $6 $7}' fio) W1=$(awk '$0~"'WRITE:'"{print $2 $3 $6 $7}' fio) echo "顺序同时读写,读 $R1 写 $W1" #随机读写 fio -filename=/var/test.file -direct=1 -iodepth 1 -thread -rw=randrw -rwmixread=70 -ioengine=psync -bs=16k -size=2G -numjobs=10 -runtime=60 -group_reporting -name=test_r_w -ioscheduler=noop > fio R2=$(awk '$0~"'READ:'"{print $2 $3 $6 $7}' fio) W2=$(awk '$0~"'WRITE:'"{print $2 $3 $6 $7}' fio) echo "随机同时读写,读 $R2 写 $W2"赋予可执行权限,直接执行,等待结果。 |
今日新闻 |
点击排行 |
|
推荐新闻 |
图片新闻 |
|
专题文章 |
CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭 |