Thursday, May 2, 2024
54
rated 0 times [  54] [ 0]  / answers: 1 / hits: 153465  / 2 Years ago, sun, january 30, 2022, 3:13:03

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?


More From » command-line

 Answers
2

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
[~]$

[#28822] Monday, January 31, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
olouredping

Total Points: 259
Total Questions: 100
Total Answers: 121

Location: New Caledonia
Member since Wed, Sep 15, 2021
3 Years ago
;