slow down dd - how?

David Kelly dkelly at hiwaay.net
Fri Jul 9 13:31:58 UTC 2010


On Fri, Jul 09, 2010 at 01:44:00AM -0500, Robert Bonomi wrote:
> >
> > > How can I slow down dd?
> >
> > you could use some creative shellscripting (probably in addition to idprio):
> >
> > dd if=/dev/zero bs=1024k | ( dd bs=1024k count=10; sleep 3 ) | dd bs=1024k of=/dev/somewhere
> >
> > This pauses for 3 seconds for every 10MB written. ...
> 
> I must be missing something. 

You are not missing anything.

> Doesn't that "dd ... ; sleep" in the sub-shell need to be in a _loop_
> of some sort?

Yes.

dd if=/dev/zero bs=1024k | ( dd bs=1024k count=10; sleep 3 ) | dd bs=1024k of=/dev/null
0+10 records in
0+10 records out
655360 bytes transferred in 0.001183 secs (554077619 bytes/sec)
0+10 records in
0+10 records out
655360 bytes transferred in 3.003105 secs (218227 bytes/sec)

> I would expect the dd in the sub-shell to _exit_ after the first 10mb, 
> whereupon the subshell would exit after the 3 second sleep, whereupon 
> 'somebody" is going to holler about a 'broken pipe'.

Am not sure why the actual example blocksize was 64k but the results are
the same for FreeBSD and MacOS X.

-- 
David Kelly N4HHE, dkelly at HiWAAY.net
========================================================================
Whom computers would destroy, they must first drive mad.


More information about the freebsd-questions mailing list