How can I know how long `dd` cloning will take? [duplicate]

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.


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

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...


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