Monitoring the Progress of dd Commands in Linux

As a Linux user, you've likely used the dd command at some point to copy data between devices or files. dd is a powerful tool, but one downside is that it doesn't show progress by default. This can be frustrating when copying large amounts of data.
Fortunately, there are some simple tricks to monitor the progress of dd operations.
Why Showing Progress Matters
When cloning a drive or copying a large file with dd, it's helpful to visualize the progress. Without any progress output, dd makes it seem like nothing is happening and you don't know if the command is still working or has stalled. Showing progress gives you peace of mind that the copy is still in progress and when you can expect it to complete.
Using status=progress with dd
The easiest way to monitor dd progress is to use the status=progress option:
sudo dd if=/dev/sda of=/dev/sdb status=progress
This will display periodic progress statistics like this:
194560+0 records in
194560+0 records out
996147200 bytes (1.0 GB, 931 MiB) copied, 5.56784 s, 179 MB/s
The output shows the number of records copied, bytes copied, and the copy rate. This gives you real-time insight into how dd is progressing.
Sending SIGINFO signal
If you've already started a dd process and forgot to add the status=progress option, there is another method using signals.
You can have dd print an intermittent progress update by sending the SIGINFO signal to the running process:
killall -SIGINFO dd
Or if you know the process ID:
kill -SIGINFO <pid>
Either command will cause dd to print to stderr and show you the current progress without interrupting the copy.
Using pv to Monitor Progress
For more flexibility in visualization, you can use a utility called pv (Pipe Viewer). pv allows piping data through and monitoring the transfer rate and progress in real-time.
To see pv in action:
dd if=/dev/sda | pv | dd of=/dev/sdb
As dd copies data, pv will display both the byte count and percentage complete. It also provides a progress bar and transfer speed. This gives even more detail into the file copy operation.
Getting Progress for Files (not just Devices)
The previous examples are useful for copying full drives or partitions. But what about just copying a single file?
You can combine dd with pv to show progress when copying files too:
dd if=input.iso | pv | dd of=output.iso
By splitting the copy into smaller chunks that pv can analyze, you get the same progress view for file copies.
Summary
- Use
dd status=progressto easily add basic progress - Send SIGINFO signals to print periodic status without interrupting
dd - Use
pvin a pipe for more detailed progress statistics - Monitor file copy progress with
dd,pvand output files
Getting progress feedback is essential when copying large amounts of data with dd. Hopefully these tips help you better monitor dd commands and avoid wondering whether they are still working properly.
Keep an eye on the progress and enjoy some peace of mind for your dd data transfers.
