dd command “progress bar”

I am using sometimes

1
2
$ sudo dd if=/dev/urandom of=/dev/sdd1
$ sudo dd if=/dev/zero of=/dev/sdd1

and I would like to see the progress of dd command. So, do the following:

1. open a new terminal/console and type:

1
$ sudo killall -USR1

2. open the terminal/console where your dd is running and you will see something like this:

1
2
3
2242867712 bytes (2.2 GB) copied, 396.007 s, 5.7 MB/s
5625297+0 records in
5625297+0 records out

Anyway, your dd command will continue without any problem.
That’s all!

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

It is better to use “sudo pkill -USR1 ^dd$” instead of killall. If you use killall you send the signal to every process running on your system, which can have unpredictable results.

@Dan, thanks for your suggestion, but in my post I forgot to add “dd” to killall command, so, the correct command should be: sudo killall -USR1 dd

Just a tip about zeroing drives with dd :
use bs=”buffer size ofthe driver” for the speedy erase.
You can try several dd, letting it go about 2 min then ctrl-c
and compare the output. So:
dd if=/dev/null of=/dev/”sdX” bs=”buffer size of the harddisk”

you can see the buffer size with hdparm -i /dev/”sdX”

sdX here is the drivename you have to substitte can be sda sdb …

BE CAREFUL!!!

If someone is wondering how to do this in BSD here is the code:

dd if=/dev/path of=/dev/path bs=1048576 &
ddpid=$!
while [ -d /proc/$ddpid ]; clear; do kill -INFO $ddpid; sleep 10; done

-INFO is the same that -USR1 but for BSD environments.

Hope this helps someone.

Really useful tip – many thanks!

I use dd a lot, and it always troubled me that you get *no* indication that it’s even doing anything at all! This has solved that worry :-)

Just don’t try it on Solaris as you’ll kill your dd command.

Leave a comment

(required)

(required)