JUST DO IT ~

我只想当个程序员

dd 测试磁盘读写 linux mac

time dd if=/dev/zero bs=1024 count=1000000 of=./1Gb.file
dd if=./1Gb.file bs=64k |dd of=/dev/null
dd if=./1Gb.file bs=1MB |dd of=/dev/null
time有计时作用,dd用于复制,从if读出,写到of。if=/dev/zero不产生输出,因此可以用来测试纯写速度。同理of=/dev/null不产生输入,可以用来测试纯读速度。bs是每次读或写的大小,即一个块的大小,count是读写块的数量。
写问文件测试
~/tmp>  time dd if=/dev/zero bs=1024 count=1000000 of=./1Gb.file
1000000+0 records in
1000000+0 records out
1024000000 bytes (1.0 GB) copied, 2.28148 s, 449 MB/s
real 0m2.287s
user 0m0.240s
sys 0m1.933s
~/tmp> dd if=./1Gb.file bs=64k |dd of=/dev/null
15625+0 records in
15625+0 records out
1024000000 bytes (1.0 GB) copied, 2.67729 s, 382 MB/s
2000000+0 records in
2000000+0 records out
1024000000 bytes (1.0 GB) copied, 2.67744 s, 382 MB/s
~/tmp> rm -rf 1Gb.file 
~/tmp> dd if=./1Gb.file bs=1MB |dd of=/dev/null
1024+0 records in
1024+0 records out
1024000000 bytes (1.0 GB) copied, 2.40457 s, 426 MB/s
1999872+1023 records in
2000000+0 records out
1024000000 bytes (1.0 GB) copied, 2.40462 s, 426 MB/s







参考:
http://www.tsingpost.com/articles/201401/344.html


语法:dd [选项]

if =输入文件(或设备名称)。

of =输出文件(或设备名称)。

ibs = bytes 一次读取bytes字节,即读入缓冲区的字节数。

skip = blocks 跳过读入缓冲区开头的ibs*blocks块。

obs = bytes 一次写入bytes字节,即写入缓冲区的字节数。

bs = bytes 同时设置读/写缓冲区的字节数(等于设置ibs和obs)。

cbs = byte 一次转换bytes字节。

count=blocks 只拷贝输入的blocks块。

conv = ASCII 把EBCDIC码转换为ASCIl码。

conv = ebcdic 把ASCIl码转换为EBCDIC码。

conv = ibm 把ASCIl码转换为alternate EBCDIC码。

conv = block 把变动位转换成固定字符。

conv = ublock 把固定位转换成变动位。

conv = ucase 把字母由小写转换为大写。

conv = lcase 把字母由大写转换为小写。

conv = notrunc 不截短输出文件。

conv = swab 交换每一对输入字节。

conv = noerror 出错时不停止处理。

conv = sync 把每个输入记录的大小都调到ibs的大小(用NUL填充)。

posted on 2015-07-19 12:12 小高 阅读(487) 评论(0)  编辑  收藏 所属分类: 工作环境搭建GUN命令


只有注册用户登录后才能发表评论。


网站导航:
 

导航

<2015年7月>
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

统计

常用链接

留言簿(3)

随笔分类(352)

收藏夹(19)

关注的blog

手册

搜索

积分与排名

最新评论

阅读排行榜

评论排行榜