Watching the progress of a dd action

dd is one of those indispensable Unix / Linux utilities whether its cloning or wiping a drive or simply creating a bootable flash drive from an image file. The problem is operations like wiping a drive with the output from /dev/zero can take an extremely long time especially on larger hard drives. In situations like this it can be handy or somewhat soothing for the impatient to know how far through the requested action the process is.

Luckily its pretty simple to find out, simply open a new tab and execute:

pgrep -l ‘^dd$’

This will give you the process number of the dd process. Take a note of this then we simply send a USR1 signal to the dd process:

kill -USR1 process_number

When the USR1 signal is received by dd it will print out its progress and continue with its copying. So if you now switch back to the terminal tab you started the dd process from you should see something similar to the below.

It may not look like much but given the process is around 800mb through the process and my flash drive is 8gb in size at a glance I can see the process is around 10% done.

If required you can also combine the watch command with kill to send the USR1 signal to the dd process after a predetermined amount of time. For example the below command will give an update on the the progress of the dd action every 30 seconds.

watch -n 30 kill dd_process_number

More Reading:

dd on Wikipedia
The dd man page

Leave a Reply

Your email address will not be published.