Try pv
, the pipe viewer. I just tested and it works on /dev/sda
directly, meaning you even get a deterministic progress bar.
Regarding the times:
I created a random file with dd if=/dev/urandom of=random bs=4k count=10000
. I then tried several methods of reading it:
$ time dd if=random | gzip >rand.gz
800000+0 records in
800000+0 records out
409600000 bytes (410 MB) copied, 17.9261 s, 22.8 MB/s
real 0m17.940s
user 0m16.545s
sys 0m1.248s
$ time pv random | gzip >rand.gz
391MB 0:00:17 [22.1MB/s] [==================================>] 100%
real 0m18.048s
user 0m16.477s
sys 0m1.048s
$ time <random gzip >rand.gz
real 0m18.410s
user 0m16.401s
sys 0m0.596s
I ran it again, pv
and dd
were even closer and lower than <
. I conclude that the performance of pv
and dd
are the same to within a very small margin of error.
dd
and want to monitor its progress, check out How to monitor the progress of dd? – palswim Sep 29 '17 at 19:34