Realtime stats of dd

There are at least two ways of getting the progress of the dd command. One is sending the dd command the -USR1 kill signal, which will cause it to print out its current progress to stderr:

kill -USR1 `pidof dd`

The other way is to examine the fdinfo file (either 0 or 1) for the dd process under /proc to see how much data has currently been copied. This is more efficient and way faster than sending dd a signal as it’s pulling directly from /proc and instead of waiting for dd to catch the signal.

root@debian:~# printf '%0.3fGB\n' $(bc -l <<< "$(awk '{if ($1 ~ "pos") print $2}' /proc/`pidof dd`/fdinfo/0) / 1073741824") 15.310GB root@debian:~#

Run it in a loop for stats every few seconds:

while :; do clear; printf '%0.3fGB\n' $(bc -l <<< "$(awk '{if ($1 ~ "pos") print $2}' /proc/`pidof dd`/fdinfo/0) / 1073741824"); sleep 2; done

Leave a Reply

Your email address will not be published. Required fields are marked *


six × = twenty four