Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Jul 2010 08:31:52 -0500
From:      David Kelly <dkelly@hiwaay.net>
To:        Robert Bonomi <bonomi@mail.r-bonomi.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: slow down dd - how?
Message-ID:  <20100709133152.GA40320@Grumpy.DynDNS.org>
In-Reply-To: <201007090644.o696i0QK028217@mail.r-bonomi.com>
References:  <201007090644.o696i0QK028217@mail.r-bonomi.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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@HiWAAY.net
========================================================================
Whom computers would destroy, they must first drive mad.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100709133152.GA40320>