Give DD a progress bar

This is a short description on how you can get a progress bar to your dd command or other commands as well using the command pv.
pv is a shell pipeline element to meter data passing through and can be installed using aptitude in Ubuntu.


# aptitude install pv

As an example I create a empty file with zeroes with a block size of 1MByte and it is going to be 1GByte in total

# dd if=/dev/zero bs=1M count=1000 | pv -s 1G | dd of=/tmp/1G
1000+0 records in 165MB/s] [================================> ] 93% ETA 0:00:00
1000+0 records out
1048576000 bytes (1.0 GB) copied, 6.24504 s, 168 MB/s
1e+03MB 0:00:06 [ 160MB/s] [================================> ] 97%
2048000+0 records in
2048000+0 records out
1048576000 bytes (1.0 GB) copied, 7.90455 s, 133 MB/s

The file /tmp/1G is now filled with zeroes sizing 1GByte.

One thought on “Give DD a progress bar

  1. Olivier MORIN

    You will have a perfetc 100% !
    dd if=file.name.in | pv -s `stat -c %s file.name.in ` | dd of=file.name.out

Comments are closed.