dd命令测试磁盘性能

创建一个虚拟文件

[root@web1 ~]# dd if=/dev/zero of=/root/a.txt bs=1G count=0 seek=2
0+0 records in
0+0 records out
0 bytes (0 B) copied, 0.000249637 s, 0.0 kB/s

时间很快

不使用seek会创建一个实实在在的文件

[root@web1 ~]# dd if=/dev/zero of=/root/b.txt bs=1G count=2
2+0 records in
2+0 records out
2147483648 bytes (2.1 GB) copied, 25.0426 s, 85.8 MB/s

查看大小

[root@web1 ~]# du -sh ./*
4.0K    ./anaconda-ks.cfg
0    ./a.txt
2.0G    ./b.txt
[root@web1 ~]# ll
total 2097292
-rw-------. 1 root root       1506 May 26 08:30 anaconda-ks.cfg
-rw-r--r--. 1 root root 2147483648 Jun  9 04:59 a.txt
-rw-r--r--. 1 root root 2147483648 Jun  9 05:07 b.txt
原文地址:https://www.cnblogs.com/zh-dream/p/14867742.html