dd gets slower while reading and writing

user@user-laptop:~$ sudo dd if=sd_backup of=/dev/sdd bs=4M conv=noerror,sync

205520896 bytes (206 MB) copied, 28.564 s, 7.2 MB/s
247463936 bytes (247 MB) copied, 57.1285 s, 4.3 MB/s
260046848 bytes (260 MB) copied, 73.2388 s, 3.6 MB/s
289406976 bytes (289 MB) copied, 104.121 s, 2.8 MB/s
301989888 bytes (302 MB) copied, 119.627 s, 2.5 MB/s
318767104 bytes (319 MB) copied, 134.332 s, 2.4 MB/s
331350016 bytes (331 MB) copied, 149.977 s, 2.2 MB/s
343932928 bytes (344 MB) copied, 164.332 s, 2.1 MB/s
360710144 bytes (361 MB) copied, 180.361 s, 2.0 MB/s
432013312 bytes (432 MB) copied, 258.438 s, 1.7 MB/s
444596224 bytes (445 MB) copied, 273.024 s, 1.6 MB/s
616562688 bytes (617 MB) copied, 452.296 s, 1.4 MB/s
641728512 bytes (642 MB) copied, 482.516 s, 1.3 MB/s

How come dd gets slower after copying this 8GB file? What can I do about it?


At first, it's showing wrong numbers, because Linux caches your writes. Also disk caches may speed up reading.

After a while caches are consumed (both read and write) and speed drops. dd calculates overall speed, so then it looks like speed is dropping constantly, while in fact it was very fast in the beginning and then slower after that, but average drops slowly.

If you wait a while after finishing previous dd (or another disk intensive operation), caches will be written out and it should be fast again (in the beginning).


I found that bypassing the cache speeds dd up considerably. eg:

sudo dd if=/dev/sdxx of=whatever.img bs=32K iflag=direct oflag=direct 

transfers at over 50 MBps for the entire transfer on my system, not using the direct flags slows dd down alot after a few GB.

I hope this helps someone looking for this.