dd Tricks
Here’s a couple tips and tricks while using dd on Linux
You can view the status of an on-going dd command (I always forget to run with progress or the version you’re using doesn’t have it)
You will need another terminal window. Not a problem for me as I always use tmux, some people say screen it better.⌗
-
Find PID of dd process ->
ps aux | grep -v grep | grep dd
-
Send
USR1
signal to PID ->kill -USR1 PID_HERE
This same thing can also be one in a single command as follows
kill -USR1 $(pgrep ^dd$)
This is the “right” way (assuming you have dd version above 8.24, this can be checked by dd --version
)
This is a normal dd command -> dd if=/path/to/input of=/path/to/output
All you have to do is append status progress
-> dd if=/path/to/input of=/path/to/output status=progress
You can also use pv (you might have to install it apt install -y pv
)
This can be done -> dd if=/path/to/input | pv | dd of=/path/to/output
You can also use compression
Using XZ (this will use all cores, you can adjust -T however you’d like, it defaults to 1) -> dd if=/path/to/input | xz -T0 > /path/to/output.xz
Using GZIP -> dd if=/path/to/input | gzip > /path/to/output.gz
Here is how to write back to the device
Using xzcat (for xz) -> xzcat -T0 | dd of=/path/to/output
Using zcat (for gzip) -> zcat | dd of=/path/to/output