dd
is a very frustrating application. You often run it through complex pipes (well, I do), and you never know if it’s performing well (or if you forgot to tune the HD perf with hdparm before). The only thing you can is wait.
Well, not quite. If you read the doc, you would have found this :
Sending a USR1 signal to a running ‘dd’ process makes it print I/O statistics to standard error and then resume copying. $ dd if=/dev/zero of=/dev/null& pid=$! $ kill -USR1 $pid; sleep 1; kill $pid 18335302+0 records in 18335302+0 records out 9387674624 bytes (9.4 GB) copied, 34.6279 seconds, 271 MB/s
Interesting, isn’t it ? But I’ve found something even more interesting : pv (packaged in Debian/Ubuntu).
Description: Shell pipeline element to meter data passing through pv (Pipe Viewer) can be inserted into any normal pipeline between two processes to give a visual indication of how quickly data is passing through, how long it has taken, how near to completion it is, and an estimate of how long it will be until completion. . To use it, insert it in a pipeline between two processes, with the appropriate options. Its standard input will be passed through to its standard output and progress will be shown on standard error.
It’s very easy to use :
# dd if=/dev/hda12 | pv |dd of=/dev/hda13 88.2MB 0:00:04 [23.3MB/s] [ ]
And it can even give an ETA if you use it like cat
(e.g: pv file | nc -w 1 somewhere.com 3000
).
On joue à geek / contre-geek ?