Checking the progress of ‘dd’

Update 2: Version 8.24 of dd (from coreutils) supports checking the status of dd with the status=progress option (thanks to R for letting me know).

[17:41 chris ~]$ dd if=/dev/zero of=/tmp/file conv=noerror status=progress
697583104 bytes (698 MB) copied, 1.000000 s, 698 MB/s

Update: See comments for a much better (and prettier!) way to do it with pipe viewer. Thanks Bill!

So you’re wiping a drive or writing an image using ‘dd‘ (dataset definition) and you’re not sure where it’s up to. There’s no built in way to check the progress (until it’s finished), so I use kill and pgrep.

On one terminal, run your dd command., something like this:
dd if=/dev/zero of=/dev/sdX bs=4096

On a second terminal, run the following:
kill -USR1 $(pgrep ^dd)

Back on terminal one, it should spit out where it’s up to but keep on dd’ing away, like so:
2202+0 records in
2202+0 records out
2308964352 bytes (2.3 GB) copied, 24.3584 s, 94.8 MB/s

This only works with one instance, for multiple instances get the right dd or use a for loop to check them all.

15 thoughts on “Checking the progress of ‘dd’

  1. Try using pipe viewer (pv) to display the progress in real time:
    cat /dev/zero | pv -brt | dd of=/dev/sdX bs=4096

    You can also display a progress bar if you know the size of the drive:
    cat /dev/zero | pv -brtp -s 80g | dd of=/dev/sdX bs=4096

  2. Thanks for the tip. So I created a script, /usr/local/bin/ddp, which looks like this:

    #!/bin/sh
    # usage: ddp source dest
    cat ${1} | pv -brtp -s `du -b ${1}` | dd of=${2} bs=4096

    Since dd is usually just for copying images to physical media anyway, typing “ddp file /dev/whatever” is now both less cumbersome and more informative than plain dd.

  3. Hello!

    I’m not sure what is going on or why I’m getting a “permission denied” message when I run the command submitted above by Bill Farrow.

    Using Linux Mint 14 (live) to dd wipe my primary HDD (sda)

    sudo dd if=/dev/zero of=/dev/sda bs=1M

    then in a separate terminal I am trying to run Bill’s pv command like this.

    sudo cat/dev/zero |pv -brtp -s 80g| dd of=/dev/sda bs=1M

    I put (a) in place of (X) as I think this just means whatever drive you are wanting to check the status of.

    Is this the proper way to enter this command?

  4. Hi Robert,

    It’s one or the other.

    The first command you posted should work – there is no progress though, that’s when you need to use the kill command I posted.

    Bill’s suggestion is a different method which includes progress. You cat the /dev/zero device then pipe that to pipeviewer (which you need to have installed) and then finally to dd onto your device.

    There is a mistake in your command though (which might just be a typo here), there should be a space after cat:
    sudo cat /dev/zero |pv -brtp -s 80g| dd of=/dev/sda bs=1M

    In addition, you might need to change the size that pipeview is monitoring, it’s currently 80GB but if you have a 200GB drive, change it to 200g.

    Finally, if you don’t have pipeviewer installed, it won’t work. Run ‘pv –help’ on the command line to make sure it’s there.

    But either way, use one or the other.

    Hope that helps,
    Chris

  5. I use the PV command in a separate Terminal and even while using sudo, I get:

    sudo cat /dev/zero |pv -brtp -s 80g| dd of=/dev/sda bs=512
    dd: opening `/dev/sda’: Permission denied
    0B 0:00:00 [ 0B/s] [>

  6. Robert, try becoming root first:
    sudo -i

    Then the command:
    cat /dev/zero |pv -brtp -s 80g |dd of=/dev/sda bs=512

  7. Robert, you need the sudo on the dd, not the cat in your example:)

    cat /dev/zero |pv -brtp -s 80g| sudo dd of=/dev/sda bs=512

  8. This is an older thread but for some unix systems (including OSX) I know you can send a SIGINFO to check the status of the dd.

    The output is identical to OP’s but the call is much easier and can be done(and is only to be done) in the same terminal.
    To send a SIGINFO interrupt you can press CNTRL+T, this however will not work on every unix flavor unfortunately.

  9. you can also see if dd is running using htop, it wont give you progress but it will show you its cpu and ram use, up time, also will give you the PID so you can run the USR1 command for physical details of progress, htop in is a quick way to see that it is doing something or if its idle (of course when its idle you should already have the dd completed message in the dd terminal)

  10. New version of coreutils (8.24) adding a status progress to dd tool:

    Usage on Xubuntu 15.10:

    Open terminal shell and type these commands:

    wget ftp://ftp.gnu.org/pub/gnu/coreutils/coreutils-8.24.tar.xz
    tar -xf coreutils-8.24.tar.xz
    cd coreutils-8.24
    ./configure && make -j $(nproc)

    Run dd as root:

    sudo ./dd if=/dev/sdc of=/dev/sda conv=noerror status=progress

    You will see: Bytes, Seconds and Velocity (Bytes/seconds)

    To check versions of dd:

    Native:

    dd –version

    New (cd coreutils-8.24/src):

    ./dd –version

Leave a Reply

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