Importance du réglage de la taille de buffer lors de l’utilisation de la commande dd
.
$ sudo dd status=progress if=a_file.iso of=/dev/sdX
1226833920 octets (1,2 GB, 1,1 GiB) copiés, 495,782 s, 2,5 MB/s
$ sudo dd bs=1M status=progress if=a_file.iso of=/dev/sdX
1226833920 octets (1,2 GB, 1,1 GiB) copiés, 138,725 s, 8,8 MB/s
Default dd
buffer size is 512 octets.
Most current storage devices have bigger block sizes (such as 4096 octets).
Using a dd
bigger buffer size allow speed up transfers avoiding device block
size splitting overhead.
In our case we can see that is speed ups transfers by 3.5 times for a 10 years old USB Key capable of writing at 10 Mo/s. For recent NVME SSD storage, I’ve been reported performances from 129 Mo/s to 1,5 Go/s (approx 10x faster).
Some more rigorous test results can be found here : http://blog.tdg5.com/tuning-dd-block-size/
It shows that at a certain extend, using a big buffer size is helpfull, and too
big is not harmless, so 1M
is a good compromise for the years to come.
The Tails team recommands sudo dd if=tails.img of=/dev/sda bs=16M oflag=direct status=progress This allows a 1.3Go file to be copied in 34s at 38Mo/s (while a regular cp achieves it in 47s).
|