The Computer Oracle

dd function seems to freeze when done

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 2 Looping

--

Chapters
00:00 Dd Function Seems To Freeze When Done
00:28 Accepted Answer Score 82
01:26 Thank you

--

Full question
https://superuser.com/questions/1220867/...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#linux #archlinux #dd

#avk47



ACCEPTED ANSWER

Score 82


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