Monitoring the progress of dd

Whether you’re zeroing out an old disk drive or creating a USB flash drive with
your favorite Linux distro, dd is there to take care of business.

One of the shortcomings of using dd back in the day was the lack of
transparency into what it was actually doing and where it was at in the process.
This compounded interest when you factored in how slow drives used to be.

Fortunately, back in 2015 when GNU coreutils 8.24 came out, dd was expanded to
have a status argument that you could use the set the level of information
you’d like to be printed to stderr.

To show a bit of status information periodically, you can slap status=progress
to the end of your command:

dd if=/path/to/some.iso of=/dev/drive status=progress

Not much to it!

Sadly though, if you’re like me, you probably forget to include this on the
regular. You could CTRL+c the command and start it over, or you could leverage
the kill command to give you some information about the command like so:

kill -USR1 $(pgrep ^dd$)

Great for a one time status, but what if you want a periodic update akin to the
native dd argument? Combine this with the watch command to spit out the
status every few seconds:

watch -n 5 'kill -USR1 $(pgrep ^dd$)'

Adjust the number passed into -n to set the number of seconds you’d like the
command to run and you’re off to the races without having to restart the
process!

Josh Sherman - The Man, The Myth, The Avatar

About Josh

Husband. Father. Pug dad. Musician. Founder of Holiday API, Head of Engineering and Emoji Specialist at Mailshake, and author of the best damn Lorem Ipsum Library for PHP.


If you found this article helpful, please consider buying me a coffee.