From Electron Cloud
Jump to: navigation, search
(Created page with 'As explained [http://blog.christophersmart.com/2009/11/28/checking-the-progress-of-dd/ here] you can use <tt>pv</tt> to display a progress bar for any data transfer via pipe betw…')
 
Line 4: Line 4:
 
  # usage: ddp source dest
 
  # usage: ddp source dest
 
  cat ${1} | pv -brtp -s `du -b ${1}` | dd of=${2} bs=4096
 
  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.

Revision as of 05:08, 12 April 2012

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.