dd function seems to freeze when done

I'm trying to copy an iso on a usb stick with this command:

sudo dd bs=4M if=lubuntu-17.04-desktop-amd64.iso of=/dev/sdc status=progress 

What is quite straight forward. The iso is 912M big in size. Why does the output text freeze here instead of ending the program?

956301312 bytes (956 MB, 912 MiB) copied, 11.216 s, 85.3 MB/s

I can't even stop the program from running with ctr-c.


The behavior you're seeing is only dd syncing the data on-disk after the operation. In order to optimize IO operations, Linux often reads data in larger chunks than requested (read-ahead) and delay writes so they can be combined (dirty cache). At the end of the operation, either dd syncs the file on-disk or the kernel does it implicitly, and the process remains active until all the writes are finished.

If there is no other massive IO operations on the machine you should be able to estimate how much data there is left to write by looking at the "Dirty:" value in /proc/meminfo - this is the total amount of data pending to be written to disk.

The amount of data the system can leave unwritten in memory at any one time can be controlled with the following sysctl tuning knobs. By default only the ratios are used. You can define the value in percent (ratio) or bytes.

vm.dirty_background_ratio
vm.dirty_ratio
vm.dirty_background_bytes
vm.dirty_bytes

You will find the official documentation for these parameters here:

https://www.kernel.org/doc/Documentation/sysctl/vm.txt