dd is an excellent tool for low-level copying. It is often used to create disk images, wipe disks and transfer files when used in combination with netcat.
One frustrating “feature” of dd is that by default it provides no output until it exits. I recently discovered that it is possible to get the progress of a dd process by sending it the USR1 signal.
To receive regular progress updates you can use watch to repeatedly send the USR1 signal. As watch normally runs in the foreground you can use nohup to run it in the background. Run the following before starting dd:
# nohup watch pkill -USR1 dd >/dev/null &
Then run dd as usual:
# dd if=/dev/zero of=file bs=1M 239+0 records in 239+0 records out 250609664 bytes (251 MB) copied, 0.466951 s, 537 MB/s 326+0 records in 326+0 records out 341835776 bytes (342 MB) copied, 2.54462 s, 134 MB/s 354+0 records in 354+0 records out 371195904 bytes (371 MB) copied, 4.93833 s, 75.2 MB/s
Don’t forget to terminate watch once your dd process has completed!
Categories Linux
Leave a Reply