Dd with progress

From Electron Cloud

Jump to: navigation, search

As explained here you can use pv to display a progress bar for any data transfer via pipe between processes. So to use dd in the usual way to copy an entire partition or disk, but with a progress bar, write this script as /usr/local/bin/ddp:

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

Then you can do something like

ddp /path/to/fs.img /dev/sdf1

which is a bit nicer than having to remember the if= and of= parameters and the blocksize, and you get a progress bar to boot.

Personal tools