0

This question already has an answer here:

This is with OSX. When I run this in a terminal

scottcarlson$ sudo dd if=Downloads/CentOS-7-x86_64-Everything-1511.iso of=/dev/disk2 2> Desktop/out.txt

and then this in another

tail -f Desktop/out.txt

it only updates the log when I press Ctlt in the first terminal with the dd. Is this because of the nature of dd?

I don't know exactly how it writes to devices, but could it be too demanding for the process to take a break and write to the log?

marked as duplicate by jlliagre, G-Man, Jeff Schaller, Networker, Wouter Verhelst Jul 23 '16 at 9:31

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • @jlliagre I believe I'm asking more precisely why it outputs when I press cntl+t. – scarlso9 Jul 23 '16 at 1:19
  • Which is precisely explained here: unix.stackexchange.com/a/59076/2594 – jlliagre Jul 23 '16 at 1:32
  • See also askubuntu.com/questions/215505/… – jlliagre Jul 23 '16 at 1:35
  • Maybe I am misunderstanding that explanation, so is cntl+t a macro for kill -INFO $PID? – scarlso9 Jul 23 '16 at 1:36
  • Kind of. It is actually directly sending the SIGINFO signal, just like Ctrl-C is sending the SIGQUIT one. On Linux you would send SIGUSR1 for the same effect, but there is no keyboard shortcut. – jlliagre Jul 23 '16 at 1:56
0

It only updates the log when I press Ctlt in the first terminal with the dd. Is this because of the nature of dd?

Yes. It is in the nature of dd to output its current status when it receives a given signal. Under most OSes, this signal is SIGUSR1, a standard signal but on OS X, it uses for the same a non standard signal named SIGINFO. Moreover, OS X has a tty driver setting that allows to send that specific signal with a key combination, CtrlT, just like CtrlC sends SIGQUIT on all OSes.

I don't know exactly how it writes to devices, but could it be too demanding for the process to take a break and write to the log?

You are precisely asking it to do that with the shortcut. Should you want to have regular automatic updates, nothing forbids you to do a simple shell loop like that one:

while kill -INFO $(pgrep dd); do sleep 5; done

This assumes pgrep is available on OS X. Otherwise, pick the pid of your dd command and use it as kill second argument.

1

What you're seeing with ctlt is a summary of the running process information, not dd's output.

dd does not output any progress information, unlike what you seem to expect.

If you want to see the actual progress from another terminal window, look at the output file size changing. In this case you're writing to a raw disk, so patience is probably your best friend here.

  • Ok thank you. I originally did not think dd output anything based on my experience, but a Google search led me to think otherwise. Can you suggest a good method to see information about the transfer (like percent of transfer completed) for OS X? I have brew installed. In rhel I know how to do it but the same method does not work in OS X. – scarlso9 Jul 23 '16 at 1:13
  • Not in your current case where you're writing to a device, not a file. If it was a file, you could look at the size changing but with a device or partition, there is no way to monitor its progress. I can imagine many ways that it could be done but not as efficiently and since it's probably very slow already, just let it run until it finishes. – Julie Pelletier Jul 23 '16 at 1:14
  • Well here's to waiting around for 12 hours.. It's a 26gb file haha – scarlso9 Jul 23 '16 at 1:23
  • That does seem quite slow. Are you reading and writing on the same device? What type of drive is the output device? – Julie Pelletier Jul 23 '16 at 1:27
  • Only writing and it's a 16gb usb 2.0 drive, I'm writing a very large iso. – scarlso9 Jul 23 '16 at 2:04
0

On OS-X, if you run stty -a you'll see that ^T is the key combination for status

% stty -a | grep '\^T'
        min = 1; quit = ^\; reprint = ^R; start = ^Q; status = ^T;

From man dd

 If dd receives a SIGINFO (see the status argument for stty(1)) signal,
 the current input and output block counts will be written to the standard
 error output in the same format as the standard completion message.  If

The two together mean that while dd is running, hitting ^T will cause a summary display to be written.

-1

You can send the SIGUSR1 signal to dd which will cause it to output it's current progress to stderr allowing you to view the output.

kill -SIGUSR1 $(pgrep dd) 

Edit: as noted below, on OSX you'd need to send the INFO signal as USR1 is for Linux only.

  • Thank you for the answer, but isn't there a conflicting view with what your answer and this answer here for a Somali question where he says use kill -INFO $PID post is here: unix.stackexchange.com/a/59076/2594 – scarlso9 Jul 23 '16 at 1:48
  • The command I posted and the one the other user posted do the same thing, just a different way of going about it. The only meaningful difference which that answer points out is sending a SIGUSR1 signal is for Linux only, so for BSD and OSX you'd use the INFO signal. Original post updated. – Jak Gibb Jul 23 '16 at 1:53

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