Sunday, September 4, 2011

HOWTO: dd a disk and watch progress

On linux, dd a disk and watch progress with this command. $! is the PID of the most recent background command:
dd if=/dev/zero of=/dev/null bs=512k&
while [ $! ]; do kill -USR1 $! && sleep 10 ; done

OS X uses a different signal:
dd if=/dev/zero of=/dev/null bs=512k&
while [ $! ]; do kill -SIGINFO $! && sleep 10 ; done

2 comments:

  1. Personally I've been using
    pkill -SIGUSR1 ^dd$
    but I think $! is more correct.

    ReplyDelete
  2. One thing I don't like about this way is it doesn't exit cleanly. You end up with a bajillion 'no such process' errors. Still needs some tweaking.

    ReplyDelete