Flashing Ubuntu ISO to USB stick with dd: recommended block size
Solution 1:
My standard dd
block size is bs=4096
Some years ago I tested different block sizes, and found that bs=4096
is a good value for most cases. It made no big difference to increase the block size to higher values. If I understood correctly, it was also the value used by several programs (cat, cp etc). This is the block size used for dd
under the hood in mkusb.
Things may have changed since I tested different block sizes, but I think the speed in your case is limited by the flash memory hardware. A fast USB 3 pendrive or fast memory card will be 5 times faster (~25 MB/s) even when connected via USB 2. See this link and links from it,
help.ubuntu.com/community/Installation/FromUSBStick#Notes_about_speed
So you can continue with bs=1M
or use bs=4096
.
If you wish, you can try some different block sizes, but do not expect any big improvement. Please come back and report the result, particularly if you find a major improvement. In that case it is also important to specify the hardware and the operating system (version of Ubuntu).
Edit: New test
I tested again, with current Lubuntu 16.04 LTS versions, and computer hardware of different kind and age, as described in the following table and graphs.
Test details
- The test was run with a shell-script, that for each block size wiped and synced the first Gibibyte of the target USB pendrive (overwrote with zeros), then cloned and synced from a Lubuntu iso file (which is slightly smaller than one Gibibyte, so within the wiped part of the pendrive).
- In all cases a pure
dd
command line was used (no piping viapv
or similar commands). Most tests were run from Lubuntu 16.04.2 LTS amd64 system (with a yakkety kernel) installed in an SSD, but the tests in an HP xw8400 workstation were run with the installed Lubuntu 16.04 LTS i386 system (with a xenial kernel) in an internal HDD.
'Extreme' and 'Cruzer_blade' are Sandisk USB pendrive models
- 'drive port' is where the target USB pendrive is connected
'os port' is where the SSD or HDD with the operating system is connected
-
More details are listed in the following table, and the variations due to the block size are illustrated in the following graphs with
log (block size)
along the x-axis because of the character of the range of block size values,- 512 (default)
- 4096 (4K)
- 65536 (64K)
- 1048576 (1M)
- 4194304 (4M)
Conclusions
The default block size,
bs=512
(bytes) makesdd
slow.Cloning with block sizes from
bs=4096 to 4M
run at 'full speed'. There are only minor differences between the test cases (except forbs=512
).