Monday, August 20, 2012

Checking the progress of 'dd' command execution

Start the 'dd' command in back-ground:
[root@hostxyz ~]# dd if=/dev/sda of=/dev/sandisk1 &
[1] <PID>

Execute either of  following while statement against the PID captured in the previous command:
[root@hostxyz ~] # while true; do kill -10 <PID>; sleep 10; clear; done
(or)
root@hostxyz ~] # while true; do kill -USR1 <PID>; sleep 10; clear; done

SAMPLE EXECUTION

[root@hostxyz ~]# dd if=/dev/zero of=/dev/sdf1 &
[1] 2069
[root@hostxyz ~]# while true; do kill -10 2069; sleep 5; clear; done
14207400+0 records in
14207400+0 records out
7274188800 bytes (7.3 GB) copied, 38.1668 s, 191 MB/s
15276232+0 records in
15276232+0 records out
7821430784 bytes (7.8 GB) copied, 43.1825 s, 181 MB/s
17829523+0 records in
17829523+0 records out
9128715776 bytes (9.1 GB) copied, 48.1945 s, 189 MB/s
18739498+0 records in
18739498+0 records out
.
.
<so on>

2 comments:

  1. Generally, it is possible to use these commands:
    [root@hostxyz ~]# dd if=./image.iso of=/dev/sdf1 bs=1M& pid=$!
    [root@hostxyz ~]# while [ -f /proc/$pid/exe ]; do kill -USR1 $pid; sleep 5; clear; done

    ReplyDelete