Actually the speed reported by dd

benchmarkddperformance

I always thought that when doing:

dd if=/dev/sdx of=/dev/sdy

the report which is displayed once the command finishes, such as:

79304319+0 records in
79304319+0 records out
40603811328 bytes (41 GB) copied, 459.645 s, 88.3 MB/s

contains the speed which corresponds to the slowest one between:

  • The read speed from the input,
  • The write speed to the output,
  • What happens between the read and the write,

that is if I'm copying data from an USB drive which have a read speed of 5 MB/s to an SSD, dd will actually report 5 MB/s, independently of the speed of the SSD.

In practice, I was copying a disk connected to USB 2 (checked it twice, the manual says it's USB 2.0 and even precises the connection speed of 480 Mbps), and noticed that dd reports the speed which varies from 65 to 88 MB/s, that is higher than the maximum speed of 60 MB/s for USB 2.0.

What is happening there?

Is the speed shown by dd the addition of the read speed and write speed (which would mean that the actual speed is approximately 40 MB/s, which makes more sense)?


Additional information: I was doing a copy of a hard disk which presents an increasing number of bad sectors in order to have a clone I can experiment with. After copying the whole disk, the reported speed is indeed higher than expected:

3902854784+0 records in
3902854784+0 records out
1998261649408 bytes (2.0 TB) copied, 26040.5 s, 76.7 MB/s

given that the command was repeated for the first few (2 to 3) gigabytes only. I checked and rechecked, the copied disk is the correct one and the motherboard has no support for USB 3 (and there are no additional PCI-e cards for USB 3).

hdparm's results are even stranger:

$ hdparm -tT /dev/md0

/dev/md0:
 Timing cached reads:   13498 MB in  2.00 seconds = 6755.77 MB/sec
 Timing buffered disk reads: 486 MB in  3.00 seconds = 161.77 MB/sec

$ hdparm -tT /dev/md0

/dev/md0:
 Timing cached reads:   15058 MB in  2.00 seconds = 7536.75 MB/sec
 Timing buffered disk reads: 418 MB in  3.01 seconds = 138.91 MB/sec

$ hdparm -tT /dev/md0

/dev/md0:
 Timing cached reads:   15038 MB in  2.00 seconds = 7527.54 MB/sec
 Timing buffered disk reads: 386 MB in  3.01 seconds = 128.38 MB/sec

Best Answer

In general dd displays the time it took for the entire transfer and the speed is "amount of data divided by time it took". Basically it's the same you should get with time dd ..., no magic there.

40603811328 bytes (41 GB) copied, 459.645 s, 88.3 MB/s
40603811328 / 459.645 / 1000 / 1000 = 88.3373

Maybe you cancelled the dd at some point and restarted it, whereupon a substantial portion of the data was already cached and thus the cache is messing with your statistics? You can try hdparm -tT /dev/disk to get a rough estimate of actual drive speeds.

For USB2 the speed is indeed highly suspect, I hope you did not use the wrong devices by accident.

Related Question