How can I know how long `dd` cloning will take?
Solution 1
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
Solution 2
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.
Solution 3
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...
Solution 4
There is already another extended dd called dcfldd
that do many funny stuff as this you are asking for http://dcfldd.sourceforge.net/
sudo apt-get install dcfldd
- Instead of
dd
you writedcfldd
Related videos on Youtube
Gabriel Theron
Updated on September 18, 2022Comments
-
Gabriel Theron almost 2 years
I'm trying to post some data with AJAX. I'm sending a serialized form, but nothing is sent. What can go wrong ? How can I fix it?
$.ajax({ url: 'postcreaorganisation', type: 'POST', data: $('#form').serializeArray(), processData: false, success: function(data) { //success action }, error:function (xhr, ajaxOptions){ //error action } });
Thanks in advance!
Edit : I should specify that I use that code in a dialog confirm button's action.
-
Th0rndike about 12 yearsis that your url? postcreaorganisation?
-
Gabriel Theron about 12 yearsYep. Nothing wrong here (it's a controller). And I checked, the controller receives the post, for that matter.
-
Klaus Byskov Pedersen about 12 yearsYour form's id is
form
? And you are sure that the (relative) url is correct? -
Anthony Grist about 12 yearsSo the AJAX request is sent, just minus the form data? Have you tried using
$('#form').serialize();
instead? -
akalucas about 12 years@GabrielTheron and the controller handles the request correctly? What is the exact data that you get back?
-
Gabriel Theron about 12 yearsBoth URL and id are correct. Only a post request is sent. I'll try
serialize();
and tell you what I get. The controller, for the moment, simply prints the data it receives, which isArray
orarray (0) {}
(if I encode with JSON) -
Gabriel Theron about 12 yearsThe content of the post is always empty, both with
serialize()
andserializeArray()
. It's my controller that prints Array or array (0) {}. -
Bhavesh G about 12 yearsuse firebug in mozilla or use developer tools in google chrome; analyze network status, and check there if any error.
-
Gabriel Theron about 12 yearsI used Firebug to see the content of the POST. It's empty, but there is no network error of any kind. Everything works fine, except it doesn't seem to find the form/"believes" it's empty
-
gen_Eric about 12 yearsTry to
console.log($('#form').serializeArray())
. Make sure there's something there. Do all your form fields havename
attributes? -
Gabriel Theron about 12 yearsWith name it works. I generated ids instead of name :/ It works now, thanks a lot!
-
Admin over 8 yearsthere is another discussion with various ways of doing this askubuntu.com/questions/215505/…
-
Admin over 5 yearsThe duplicate question has a more updated answer.
-
Admin over 5 years@Garrett correct. Hence why this was marked as a duplicate of that one. Thank you.
-
-
Gabriel Theron about 12 yearsThank you again for that very helpful answer ^^
-
Mechanical snail over 11 years
pv
is much more convenient though. -
Luis Alvarado over 11 yearsCan you additionally add a case for creating a clone of a disc, like dd if=/dev/sda of=/dev/sdb with the pv command.
-
Mechanical snail over 11 years@LuisAlvarado:
pv /dev/sda > /dev/sdb
. Also gives you a nice progress bar. -
Luis Alvarado over 11 years@Mechanicalsnail - Wait, are you saying I can clone a disc like that?
-
Rucent88 over 11 years@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"
-
Luis Alvarado over 11 years+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.
-
balupton about 10 yearsThis didn't work on OSX, it just killed it... which is unfortunate, as it had already been running for an hour... :(
-
Luis Alvarado about 10 years@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!
-
Trevor Rudolph almost 10 yearsdont forget
dd if=/dev/sda | pv | dd of=/dev/sdb
-
Trevor Rudolph almost 10 yearsmaybe even try the size argument
-s
in bytes of source -
Nux almost 9 yearsDo NOT run
kill $pid
. This might kill the copy proccess. @Luis your answer is a bit missleading. All you need to do is runps -a | grep dd
and then send the signal to aquired pidkill -USR1 123456789
(where "123456789" is the pid). -
Luis Alvarado almost 9 years@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.
-
Marc.2377 almost 8 years@balupton "On BSD systems, you need to send the INFO signal. Linux doesn't have a SIGINFO and uses USR1 instead." See here
-
Jorn over 5 yearsFor those of you who can now finally monitor the throughput but wonder why it's <10kiB/s, see unix.stackexchange.com/a/322224/120881
-
abhchand about 3 yearsFYI 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 :)