Linux dd Command Show Progress Copy Bar With Status

by on October 20, 2012 · 7 comments· LAST UPDATED October 20, 2012

in

I'm using dd command for block level copy and just found out that there's no built in way to check the progress. How do I use the Linux or Unix dd command while coping /dev/sda to /deb/sdb and display a progress bar when data goes through a pipe?

You need to use the pv command which allows you to see the progress of data through a pipeline. You need to install pv command as described here.

Tutorial details
DifficultyIntermediate (rss)
Root privilegesYes
Requirementsdd and pv
Estimated completion timeN/A
Once installed, type the following commands to see the status bar. Please note that if standard input is not a file and no size was given with the -s option, the progress bar cannot indicate how close to completion the transfer is, so it will just move left and right to indicate that data is moving. It will also show average MB/s rate:

Examples

WARNING! These examples may crash your computer and may result into data loss if not executed with care.

Copy /dev/sda to to /deb/sdb:

 
pv -tpreb /dev/sda | dd of=/dev/sdb bs=64M
 

OR

 
pv -tpreb /dev/sda | dd of=/dev/sdb bs=4096 conv=notrunc,noerror
 

Sample outputs:

Fig.01: pv and dd in action

Fig.01: pv and dd in action


You can create a progress bar and display using the dialog command as follows:

 
(pv -n /dev/sda | dd of=/dev/sdb bs=128M conv=notrunc,noerror) 2>&1 | dialog --gauge "Running dd command (cloning), please wait..." 10 70 0
 

Sample outputs:

HowTo: Check The Status of dd Command In Progress under Unix like operating systems

Fig.02: Show the Status of dd Command in progress using pv and dialog command

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 7 comments… read them below or add one }

1 Logicos October 20, 2012 at 8:21 pm

$ tmux
$ dd if=/dev/urandom of=/dev/null bs=16k count=100000
+

$ ps aux | grep dd
(show pid)

$ kill -SIGUSR1 (pid)

$ tmux attach
65260+0 enregistrements lus
65259+0 enregistrements écrits
267300864 octets (267 MB) copiés, 16,5587 s, 16,1 MB/s

Reply

2 Goofball James Hurley October 21, 2012 at 12:00 am

OR you could use dcfldd, if your distro/OS has it (Debian does). The awkward acronym stems from it being the Department of Defense Computer Forensics Lab’s version of dd.

Reply

3 Billy Larlad October 21, 2012 at 12:02 am

or try dcfldd, the Department of Defense Computer Forensics Lab’s dd.

Reply

4 mirodeniro October 22, 2012 at 7:11 am

killall -USR1 dd

Reply

5 Gaspar Fernandez February 10, 2013 at 9:32 am

And to make it beautiful, instead of running dialog, you can run zenity –progress –title “Working…”.

Reply

6 Tom February 20, 2013 at 3:12 am

watch -n 10 ‘killall -USR1 dd’

Reply

7 mioux February 2, 2014 at 5:37 pm

I use this command to create my Raspberry Pi compressed images
(pv -n /dev/sda | gzip -c | dd of=GentooV2.gz bs=128M conv=notrunc,noerror) 2>&1 | dialog –gauge “Dump running” 10 70 0

It’s better looking than kill -USR1

Reply

Leave a Comment

Tagged as: , , , , , , ,

Previous Faq:

Next Faq: