How to get dd to print transfer stats in MacOS?

Viewed 10001

For MacOS (Mavericks), I am making a shell script to gather transfer stats over time for command dd.

The manual page says:

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.

Therefore, just like in Linux, I tried:

kill -INFO <pid_of_dd>

The command completes successfully with status 0, however the terminal in which dd process connected to, there is no stats information in standard output/standard error.

So what is the correct way to get dd to print stats in its output?

4 Answers

You can press Ctrl+T while the dd command is running or, to have a nice progress bar, you can install pv (pipe viewer) with homebrew:

brew install pv

and then place pv in between

dd if=diskimage.img | pv | dd of=/dev/disk2

example output 1

    18MB 0:00:11 [1.70MiB/s] [      <=>                          ]

(with size of transferred data, elapsed time and speed)


Progress bar and ETA

you can also input the size of the image (16GB in this example), to have :

dd if=diskimage.img | pv -s 16G | dd of=/dev/disk2

example output 2 (with also progress bar and estimated time):

    1.61GiB 0:12:19 [2.82MiB/s] [===>                 ] 10% ETA 1:50:25
Related