Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have to dd a couple of 1TB hard drives. They are taking several hours to clone and I was wondering if there was any way possible of knowing how fast they are going, how much they have done and how long will they take to copy the rest.

All I can see is the terminal with the command running. When I run ps -e at least I know that dd is working from the CPU usage shown, but I have no way of knowing how much it has done or how long it will take to finish.

Kind of makes me crazy.

share|improve this question
add comment

3 Answers 3

up vote 9 down vote accepted

Use the program pv for any piped stream to see a live report of data transfered. It can be used for any application using pipes. It is also a great tool for seeing rate of transfer to things like USB, External disks, networked computers.

dd if=infile | pv > outfile

Or for direct copying, just use this:

pv infile > outfile

Example:

sudo pv /dev/sda1 > /home/user/sda1.ext4.img
share|improve this answer
    
Can you additionally add a case for creating a clone of a disc, like dd if=/dev/sda of=/dev/sdb with the pv command. –  Luis Alvarado Jan 1 '13 at 0:24
    
@LuisAlvarado: pv /dev/sda > /dev/sdb. Also gives you a nice progress bar. –  Mechanical snail Jan 1 '13 at 0:36
    
@Mechanicalsnail - Wait, are you saying I can clone a disc like that? –  Luis Alvarado Jan 1 '13 at 0:52
2  
@LuisAlvarado, yes, you can clone a disc like that. Mech has used another partition as the output, but you could also output to a regular file named like "sda.img" –  Rucent88 Jan 1 '13 at 7:09
    
dont forget dd if=/dev/sda | pv | dd of=/dev/sdb –  Trevor Rudolph 13 hours ago
show 1 more comment

Typical. When I ask something I then find the answer somehow (even if I looked for hours.. but magically I find it AFTER creating the question -.- ). Anyway for what I checked with dd --help which mentions at the end of the help (I can't really believe I did not see THAT) the following:

Sending a USR1 signal to a running `dd' process makes it
print I/O statistics to standard error and then resume copying.

   $ dd if=/dev/zero of=/dev/null& pid=$!
   $ kill -USR1 $pid; sleep 1; kill $pid
   18335302+0 records in
   18335302+0 records out
   9387674624 bytes (9.4 GB) copied, 34.6279 seconds, 271 MB/s

What this means is that in another terminal you would run the following line using the Process ID of the DD you want to check. For example in my case is Process Id 4112. You can see the process ID by typing ps -e and looking for dd or just ps -e|grep dd and looking at the number in the front. Take note of that number and then type in another terminal window kill -USR1 4112; sleep 1; This will give me the time, seconds elapsed since it began and how much is has copied. At least now I know it takes about 8 hours to copy 1TB of information at about 40MB/s.

share|improve this answer
    
pv is much more convenient though. –  Mechanical snail Jan 1 '13 at 0:14
    
This didn't work on OSX, it just killed it... which is unfortunate, as it had already been running for an hour... :( –  balupton Mar 31 at 17:33
    
@balupton highly recommend you post that as a bug in launchpad. Maybe is something related to all OSX or your particular case. Just tried it right now (Not OSX) and it worked, so you might be the proud owner of a huge bug. Go kill it! –  Luis Alvarado Mar 31 at 21:18
add comment

There is already another extended dd cald dcfldd that do many funny stuff as this you are asking for http://dcfldd.sourceforge.net/

sudo apt-get install dcfldd and instead of dd you write dcfldd

share|improve this answer
    
+1 but the last update to that app was in 2006. Even if it works I would still fall with the normal dd or pv until I had tried dcfldd with a lot of non-important information. –  Luis Alvarado Mar 12 '13 at 14:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.