How to make the dd command be verbose? [duplicate]
I want to make a USB bootable by cloning an image. I did some research and I haven't found a satisfactory way of making dd provide some feedback back to the console of how the progress is going.
Is there a way, built into the command to do this, aside from polling the PID via the ps command?
Solution 1:
If you read man dd
, it refers you to info coreutils 'dd invocation'
which says, in part,
Sending an INFO
signal to a running dd
process makes it print
I/O statistics to standard error and then resume copying. In the
example below, dd
is run in the background to copy 10 million blocks.
The kill
command makes it output intermediate I/O statistics, and
when dd
completes normally or is killed by the SIGINT
signal, it
outputs the final statistics.
$ dd if=/dev/zero of=/dev/null count=10MB & pid=$!
$ kill -s INFO $pid; wait $pid
3385223+0 records in
3385223+0 records out
1733234176 bytes (1.7 GB) copied, 6.42173 seconds, 270 MB/s
10000000+0 records in
10000000+0 records out
5120000000 bytes (5.1 GB) copied, 18.913 seconds, 271 MB/s
On systems lacking the INFO
signal dd
responds to the USR1
signal instead, unless the POSIXLY_CORRECT
environment variable is
set.
You can also try the status=progress
option, which will display the info in real time:
[~]$ dd if=/dev/zero of=/dev/null count=10MB status=progress
4708234752 bytes (4.7 GB, 4.4 GiB) copied, 4 s, 1.2 GB/s
10000000+0 records in
10000000+0 records out
5120000000 bytes (5.1 GB, 4.8 GiB) copied, 4.3516 s, 1.2 GB/s
[~]$
Solution 2:
There are several solutions available via google search.
From http://www.cyberciti.biz/faq/linux-unix-dd-command-show-progress-while-coping/
(pv -n /dev/sda | dd of=/dev/sdb bs=128M conv=notrunc,noerror) 2>&1 | dialog --gauge "Running dd command (cloning), please wait..." 10 70 0
You may have to install dialog and pv
sudo apt-get install pv dialog