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.

3
  • 1
    there is another discussion with various ways of doing this askubuntu.com/questions/215505/…
    – TheNano
    Nov 22, 2015 at 9:34
  • The duplicate question has a more updated answer.
    – Garrett
    Nov 14, 2018 at 7:59
  • @Garrett correct. Hence why this was marked as a duplicate of that one. Thank you. Nov 14, 2018 at 15:40

4 Answers 4

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.

6
  • pv is much more convenient though. Jan 1, 2013 at 0:14
  • 6
    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, 2014 at 17:33
  • 2
    Do NOT run kill $pid. This might kill the copy proccess. @Luis your answer is a bit missleading. All you need to do is run ps -a | grep dd and then send the signal to aquired pid kill -USR1 123456789 (where "123456789" is the pid).
    – Nux
    Sep 6, 2015 at 7:05
  • 2
    @nux Hi friend and thanks for the comment. In this case, it is coming directly from the man page. Just in case, for DD, when it receives the dummy USR1, it behaves like a more verbose log, so it outputs the last line mentioned in the example. Sep 8, 2015 at 1:10
  • 2
    @balupton "On BSD systems, you need to send the INFO signal. Linux doesn't have a SIGINFO and uses USR1 instead." See here
    – Marc.2377
    Jul 6, 2016 at 0:26
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
7
  • 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. Jan 1, 2013 at 0:24
  • @LuisAlvarado: pv /dev/sda > /dev/sdb. Also gives you a nice progress bar. Jan 1, 2013 at 0:36
  • @Mechanicalsnail - Wait, are you saying I can clone a disc like that? Jan 1, 2013 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, 2013 at 7:09
  • 1
    dont forget dd if=/dev/sda | pv | dd of=/dev/sdb Jul 23, 2014 at 17:13
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...

1
  • 1
    FYI on OSX it seems you can now press CTRL + t which gives you progress output. I'm not sure if this is a new feature, but it's available for me on OSX Catalina (10.15) and is much easier than most solutions here :)
    – abhchand
    Apr 18, 2021 at 18:50
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
1
  • 2
    +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. Mar 12, 2013 at 14:59

Not the answer you're looking for? Browse other questions tagged .