ISO27001:2013
Certified Supplier

FIND OUT MORE

We're an ISO27001:2013 Certified Supplier

blog-post-featured-image

The venerable dd command has been a staple of Unix systems since the 5th Edition, released in 1974. It reads blocks from an input file and outputs them to a destination, so although it has rather unusual options compared to modern conventions, it’s still extremely useful for duplicating or transforming disk images.

However, one function which was missing from dd for a long time is a progress indicator. There are two ways to make up for this deficiency depending if you have a modern version of dd or you are stuck with an older operating system.

First, let’s recap a couple of common usage patterns for dd itself.

Basic dd operation

dd‘s most basic function is to take an input file (remember, in Unix almost everything is a file) and stream its contents to another file. That can be in one operation thus:

That operation can also be broken into a pipeline of two dd commands, which gives us the opportunity to insert other processing into the pipeline:

pv to the rescue

Pipeviewer, or pv, is another small utility which takes standard input and passes it on through standard output, but here’s the magic: it can output a progress bar along the way. If the size of the file is known in advance then the progress bar is accurate; if not, it simply slides from side to side to indicate activity (and provides other information such as transfer rate).

A generic progress bar can be inserted into a dd pipeline directly:

Or, when the input is a normal file, pv can read it directly and then the progress bar is accurate:

dd‘s own progress

Newer versions of dd have a progress bar built in; it’s a simple extra switch to enable this:

 

Photo by SioraPhotography on Unsplash

1 thought on “`dd` progress”

  1. I think that kill responds to USR1 signal too.
    e.g. ps ax | grep dd will give the PID of the dd process

    and then in another terminal
    kill -USR1 PID_OF_DD
    will show progress of the dd process (or at least how many bytes transferred out of the total)

Leave a Reply

Your email address will not be published. Required fields are marked *