Centos下测试硬盘读写速度

作者:美云 发布日期:2020/11/10 0:27:22 浏览次数:5387 复制

这是在服务器上,读写超快。

写速度

$dd if=/dev/zero bs=1k count=1000000 of=1Gb.file

1000000+0 records in
1000000+0 records out
1024000000 bytes (1.0 GB) copied, 5.13676 seconds, 199 MB/s

读速度

$dd if=1Gb.file bs=64k |dd of=/dev/null

[haibo@localhost ~]$ dd if=1Gb.file bs=64k |dd of=/dev/null
15625+0 records in
15625+0 records out
1024000000 bytes (1.0 GB) copied, 6.37813 seconds, 161 MB/s
2000000+0 records in
2000000+0 records out
1024000000 bytes (1.0 GB) copied, 6.37891 seconds, 161 MB/s

读写速度

$dd if=1Gb.file of=2Gb.file bs=64k

15625+0 records in
15625+0 records out
1024000000 bytes (1.0 GB) copied, 2.21364 seconds, 463 MB/

这是在本地的虚拟机上

[root@localhost ~]# dd if=/dev/zero bs=1k count=1000000 of=1Gb.file
1000000+0 records in
1000000+0 records out
1024000000 bytes (1.0 GB) copied, 39.6289 seconds, 25.8 MB/s
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# dd if=1Gb.file bs=64k |dd of=/dev/null
2000000+0 records in
2000000+0 records out
1024000000 bytes (1.0 GB) copied, 39.8982 seconds, 25.7 MB/s
15625+0 records in
15625+0 records out
1024000000 bytes (1.0 GB) copied, 39.9039 seconds, 25.7 MB/s
[root@localhost ~]# dd if=1Gb.file of=2Gb.file bs=64k
15625+0 records in
15625+0 records out
1024000000 bytes (1.0 GB) copied, 46.391 seconds, 22.1 MB/s

 linux4版本用time来计时
[xxx]$ time dd if=/dev/zero bs=1k count=1000000 of=1Gb.file
1000000+0 records in
1000000+0 records out

real    0m2.035s
user    0m0.114s
sys     0m1.921s

写速度:1000M/2.035=491M

[xxx]$ time dd if=1Gb.file bs=64k |dd of=/dev/null         
15625+0 records in
15625+0 records out
2000000+0 records in
2000000+0 records out

real    0m2.420s
user    0m0.368s
sys     0m1.889s
读速度:1000M/2.420=413M