dd is a low level copy/convert program used to copy content byte for byte. Personally I have used this during disk cloning, which often involves a lot of data.
From the moment you press enter on your dd command, you have no feedback whatsoever until the command succeeds or fails. Which often leads to this feeling…
This is taking a while, has it crashed?
Probably not is the quick answer. We want to know the dd progress!
A way to get some output is to open up another terminal (while dd is running in another) then use the following command:
pgrep -l 'dd$'
This is process grep, looking for dd processes, the output will be something like this:
pgrep -l 'dd$' 7406 dd
Here the number 7406 is the process ID (which will be different in your output!), we can use this together with the following command to force some output:
sudo kill -USR1 7406
This will temporarily kill the dd process and yield some output in the terminal running dd.
WARNING: be careful to use the flags -USR1 … without them you may end up killing the ACTUAL process and wasting hours!!
The output will be the progress of your dd command, it will look something like this:
165712+0 records in 165712+0 records out 678756352 bytes (679 MB) copied, 22.7643 s, 29.8 MB/s
Once the output is displayed, dd carries on as before. You can keep running the previous kill command to view output.
… and this means?
- records in – data read
- records out – data written
- last line – a more readable summary!
dd progress?… how to make sense of the numbers
Firstly, in our dd command we set the block size to 4096, if you don’t set it dd will use 512 as default for both reading and writing (this line isn’t actually part of the dd progress output but needed for context!).
dd if=/dev/sde1 of=/dev/sde2 bs=4096
Secondly, the data read/written shows the amount of full+partial blocks processed
Thirdly, the 678756352 bytes shows the total bytes processed. This is the sum of bytes in each of the 165712 4096b blocks processed, which roughly equates to 679MB.
dd if=/dev/sde1 of=/dev/sde2 bs=4096 165712+0 records in 165712+0 records out 678756352 bytes (679 MB) copied, 22.7643 s, 29.8 MB/s
Lastly, the current data processed took 22.7643 s at a rate of 29.8 MB/s – self explanatory in this day and age!
(Thanks to Josh Perlstein)