On Sonntag, 27. März 2011 Arnd Bergmann wrote:
# Write 256 MB using 4 MB blocks dd if=/dev/zero of=/dev/sde bs=4M oflag=direct count=64
# Write 256 MB using 32 Kb blocks dd if=/dev/zero of=/dev/sde1 bs=32K oflag=direct count=8192
My guess is that in the first case, you get to around 8 MB/s, while the second one should be a bit better.
"A bit" is underestimation: # dd if=/dev/zero of=/dev/sde1 bs=4M oflag=direct count=64 64+0 records in 64+0 records out 268435456 bytes (268 MB) copied, 33.054 s, 8.1 MB/s # dd if=/dev/zero of=/dev/sde1 bs=32K oflag=direct count=8192 8192+0 records in 8192+0 records out 268435456 bytes (268 MB) copied, 17.7888 s, 15.1 MB/s
./flashbench --findfat --fat-nr=6 /dev/sde --blocksize=$[3072] --erasesize=$[12 * 1024 * 1024]
If this is the case, the stick will frequently have to do garbage collection, which makes it slower than it could be.
Why would it be so? You mean because nobody actually writes in 12MB chunks?
It seems like writing in at least 768KiB chunks gives best performance, which are 24x 32KB. Maybe there are 3x8bit chips on it?
# ./flashbench --findfat --fat-nr=6 /dev/sde --blocksize=$[3072] --erasesize=$[12 * 1024 * 1024] sched_setscheduler: Operation not permitted 12MiB 24M/s 23.6M/s 23.5M/s 23.7M/s 23.5M/s 23.6M/s 6MiB 23.4M/s 23.4M/s 23.5M/s 23.6M/s 23.2M/s 23.2M/s 3MiB 23.4M/s 23.4M/s 23.3M/s 23.4M/s 23.4M/s 23.4M/s 1.5MiB 24M/s 23.8M/s 23.6M/s 23.8M/s 24.1M/s 23.8M/s 768KiB 24.1M/s 24.2M/s 24.6M/s 24.7M/s 24M/s 24M/s 384KiB 21.6M/s 21.7M/s 21.7M/s 21.6M/s 22.1M/s 22.3M/s 192KiB 20.5M/s 20.4M/s 20.2M/s 20.6M/s 20.9M/s 20.9M/s 96KiB 25.8M/s 26.4M/s 26.2M/s 25.9M/s 25.7M/s 26.3M/s 48KiB 20.5M/s 21M/s 19.9M/s 19.8M/s 20M/s 20.6M/s 24KiB 7.85M/s 7.68M/s 8.06M/s 7.57M/s 7.62M/s 7.56M/s 12KiB 2.04M/s 2.16M/s 2.15M/s 2.17M/s 2.16M/s 2.15M/s 6KiB 1.19M/s 1.17M/s 1.14M/s 1.13M/s 1.16M/s 1.17M/s 3KiB 643K/s 642K/s 625K/s 634K/s 653K/s 650K/s
So I re-tested with dd: # dd if=/dev/zero of=/dev/sde1 bs=768K oflag=direct count=341 320+0 records in 320+0 records out 251658240 bytes (252 MB) copied, 11.4378 s, 22.0 MB/s # dd if=/dev/zero of=/dev/sde1 bs=32K oflag=direct count=8192 8192+0 records in 8192+0 records out 268435456 bytes (268 MB) copied, 16.545 s, 16.2 MB/s # dd if=/dev/zero of=/dev/sde1 bs=768K oflag=direct count=346 346+0 records in 346+0 records out 272105472 bytes (272 MB) copied, 11.1504 s, 24.4 MB/s
Yes, writing 768KiB chunks seems the best idea.