dd命令的最大块大小

时间:2015-03-07 12:52:53

标签: linux hard-drive dd

我想在SanDisk 32GB micro SD上运行dd,但我不知道如何决定块大小。

通常我使用bs=1M,但我可以更高一点吗?

2 个答案:

答案 0 :(得分:3)

试试吧!

#!/bin/bash
bs=( 32k 64k 128k 256k 512k 1m 2m 4m )
ct=( 32768 16384 8192 4096 2048 1024 512 256 )
for (( x=0;x<${#bs[@]};x++ )); do
   echo Testing bs=${bs[x]},count=${ct[x]}
   dd if=/dev/zero bs=${bs[x]} count=${ct[x]} of=junk
done

<强>输出

Testing bs=32k,count=32768
32768+0 records in
32768+0 records out
1073741824 bytes transferred in 3.094462 secs (346988217 bytes/sec)
Testing bs=64k,count=16384
16384+0 records in
16384+0 records out
1073741824 bytes transferred in 3.445761 secs (311612394 bytes/sec)
Testing bs=128k,count=8192
8192+0 records in
8192+0 records out
1073741824 bytes transferred in 2.937460 secs (365534116 bytes/sec)
Testing bs=256k,count=4096
4096+0 records in
4096+0 records out
1073741824 bytes transferred in 3.247829 secs (330602946 bytes/sec)
Testing bs=512k,count=2048
2048+0 records in
2048+0 records out
1073741824 bytes transferred in 3.212303 secs (334259206 bytes/sec)
Testing bs=1m,count=1024
1024+0 records in
1024+0 records out
1073741824 bytes transferred in 3.129765 secs (343074260 bytes/sec)
Testing bs=2m,count=512
512+0 records in
512+0 records out
1073741824 bytes transferred in 2.908048 secs (369231132 bytes/sec)
Testing bs=4m,count=256
256+0 records in
256+0 records out
1073741824 bytes transferred in 2.996609 secs (358318964 bytes/sec)

答案 1 :(得分:0)

你可以走得更高,但它可能没有任何区别。如果你走得太高,事情可能会慢下来。

不同的SSD设备具有不同的性能配置文件。对于整个世界中存在的每个SSD设备,没有通用的终极答案。

获得正确答案的唯一方法是尝试各种块大小,并对性能进行基准测试。