On Wed, 2019-09-04 at 12:44 -0700, Gordon Messmer wrote:
On 9/4/19 8:20 AM, Patrick O'Callaghan wrote:
For a USB drive it probably doesn't make much difference. Output will be buffered and speed is limited by the USB interface.
If you aren't specifying a block size, the default block size tends to involve more round-trips through the kernel and through the USB bus. In that case, it isn't the USB interface bandwidth that causes slow transfers, but the latency involved in each tiny request.
I'd test this, but I seem to have left my bag of USB drives at home today. :)
Feel free to 'dd' a drive to /dev/null with and without a specified large block size to demonstrate the difference. Maybe I'm wrong.
This is for an otherwise unused 4.5GB partition on an SSD. The CPU is an i7-3770 with 8GB of RAM:
[poc@bree ~]$ sudo time dd if=/dev/sda2 of=/dev/null 8787968+0 records in 8787968+0 records out 4499439616 bytes (4.5 GB, 4.2 GiB) copied, 11.925 s, 377 MB/s 4.48user 7.26system 0:11.92elapsed 98%CPU (0avgtext+0avgdata 2092maxresident)k 8787968inputs+0outputs (0major+89minor)pagefaults 0swaps [poc@bree ~]$ sudo time dd bs=4096 if=/dev/sda2 of=/dev/null 1098496+0 records in 1098496+0 records out 4499439616 bytes (4.5 GB, 4.2 GiB) copied, 8.42924 s, 534 MB/s 0.59user 2.43system 0:08.43elapsed 35%CPU (0avgtext+0avgdata 2216maxresident)k 8788104inputs+0outputs (2major+89minor)pagefaults 0swaps
(increasing the block size to 10MB gets 549 MB/s, i.e. almost no difference)
Given that the (theoretical) speed of USB-2 is 60 MB/s, the drive would be a bottleneck in both cases. For USB-3 (10 or 20 times faster, depending on version) there would be a difference.
poc