Printing dd stats / status

I keep Googling this, when really I should have committed it to memory by now. It’s extremely useful when cloning hard drives, which takes a long time with modern disks (a 160gb hard drive takes about an hour over eSATA @ ~50MB/s).

Anyway while there are more efficient methods, dd is simple and it works.

So given the following dd command:

dd if=/dev/sda of=/dev/sdb bs=32M

We can find out the pid (process ID) with the following command:

ps ax | grep dd

Which in my case gives:

12147  tty2    R+     6:17 dd if /dev/sda of /dev/sdb bs 32M

i.e. 12147.

To get dd to output the stats, we send it a SIGUSR1 signal:

kill -SIGUSR1 12147

Resulting in:

3205+0 records in
3204+0 records out
107508400128 bytes (108 GB) copied, 2111.05 s, 50.9 MB/s

I should thank the author of the following link, it’s the result I get whenever I google this:

http://prefetch.net/blog/index.php/2006/06/11/printing-dd-status/

3 thoughts on “Printing dd stats / status

  1. Pingback: Trying Windows 7, and backing up Vista first « Al4

  2. name

    you are missing a dash in the “ps ax | grep dd” command, just before the “ax” part, “ps -ax | grep dd”

    Reply
    1. Alex Post author

      For many ps flags the hyphen is optional, I’m not sure what OS you’re running but try it on most Linux machines and I think you’ll find it works as written :)

      Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.