dd: How to dump the output of "kill -USR1 $pid > progress.txt"?

Asked by kit

Recently my computer crashed whilst I was in the middle of dd'ing 2tb of data.

Fortunately for me, the computer froze whilst the shell executing the dd command was visible and I had been running "watch -n60 -- pkill -USR1 ^dd$" from another shell, so the last point I can be sure succeeded was visible to me on the screen.

I wrote down the number of "blocks out" so I can continue the dd with the last 600gb or so of data.

Now, what I'd like to do is dump the progress (e.g. the output that kill -USR1 $pid prints in the shell where the dd command is executed) to a text file instead of stdout so I can configure my script to process the text file at start and automatically continue (e.g. skip&seek) to the last point a successful progress output was made.

I've tried executing "dd if=in of=out > progress.txt& pid=$!" and running "kill -USR1 $pid".
I've also tried executing "dd if=in of=out& pid=$!" and running "kill -USR1 $pid > progress.txt".
Neither of the above output anything to progress.txt.

Is there a way?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu coreutils Edit question
Assignee:
No assignee Edit question
Solved by:
kit
Solved:
Last query:
Last reply:
Revision history for this message
kit (kitrule) said :
#1

Oh, don't worry. I discovered I needed to execute the dd command as follows:
dd if=in of=out 2> progress.txt& pid=$!

So marking this as solved =)