32

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.

Flimm
  • 44,031
Luis Alvarado
  • 216,643

4 Answers4

36

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.

Luis Alvarado
  • 216,643
25

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
Rucent88
  • 2,058
Sepero
  • 4,627
16

Regarding using kill to display info on a Mac, you have to pass it the -INFO flag instead of the -USR1 flag. And remember that it shows the info in the terminal where your dd process is running, so if you open a new tab to type kill -INFO $PID (where $PID is the number you found using ps -e | grep dd), you'll have to switch back to the tab where dd is running to see the output.

Now if only I could figure out how to display that output as GB or MB instead of plain bytes...

bobo
  • 161
  • 1
  • 2
4

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

  1. sudo apt-get install dcfldd
  2. Instead of dd you write dcfldd
user.dz
  • 49,176
TheNano
  • 637