dd with a progress bar

Posted in Linux

dd is a great bit stream utility to make image copies of one thing to another whether it’s a partition, a file, a device, or even a stream of zeros or randomness. But it doesn’t have much in the way of a user interface.

You can use the pv utility in conjunction with double buffering dd with pipes to get a nice little progress bar. Y ou can customize this to see elapsed time, and transfer rate.

First you’ll need to install the pv utility. Don’t worry, it’s pretty skinny. Here’s the contents of the entire package on a Fedora system.

/usr/bin/pv
/usr/share/doc/pv-1.1.0
/usr/share/doc/pv-1.1.0/COPYING
/usr/share/doc/pv-1.1.0/NEWS
/usr/share/doc/pv-1.1.0/README
/usr/share/doc/pv-1.1.0/TODO
/usr/share/locale/de/LC_MESSAGES/pv.mo
/usr/share/locale/fr/LC_MESSAGES/pv.mo
/usr/share/locale/pl/LC_MESSAGES/pv.mo
/usr/share/locale/pt/LC_MESSAGES/pv.mo
/usr/share/man/man1/pv.1.gz

The only file you’ll really need from this package is /usr/bin/pv.

Writing zeros to a usb drive while displaying elapsed time, and a rate of transfer. Update every 2 seconds.

dd if=/dev/zero | pv -ptr -i 2 | dd of=/dev/sdf

0:01:46 [5.34MB/s] [        <=>                               ]

Copy SCSI disk a to SCSI disk b

dd if=/dev/sda | pv -pt | dd of=/dev/sdb

0:01:32 [       <=>                                           ]

You can also use pv with other utilities such as tar. Using the -L option allows rate limiting. You can dynamically change the rate by opening another shell and calling pv with the remote pid!

pv -R 19832 -L 100k

This will modify the rate for the pv that is currently running with pid 19832.

Posted by admica   @   23 April 2009

Related Posts

Like this post? Share it!

Digg Twitter StumbleUpon Delicious Technorati Facebook RSS

0 Comments

No comments yet. Be the first to leave a comment !
Leave a Comment

Name

Email

Website

Previous Post
« sha1sum mass checking for tampered files
Next Post
Using dd to search for strings in memory or devices »
Powered by Wordpress   |   Lunated designed by ZenVerse