Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Aug 2002 16:24:24 +0930
From:      Greg 'groggy' Lehey <grog@FreeBSD.org>
To:        Rob Ellis <rob@web.ca>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: Best "bs" for dd copies (was: Re: Questions about vinum and failure of root partition)
Message-ID:  <20020808065424.GB8561@wantadilla.lemis.com>
In-Reply-To: <20020807153832.GA53552@web.ca>
References:  <005e01c23dcb$061acbb0$6602a8c0@swbell.net> <200208070101.g7711iU06306@clunix.cl.msu.edu> <005e01c23dcb$061acbb0$6602a8c0@swbell.net> <3.0.5.32.20020807085441.02d62db8@mail.sage-one.net> <3.0.5.32.20020807102750.02d62db8@mail.sage-one.net> <20020807153832.GA53552@web.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday,  7 August 2002 at 11:38:33 -0400, Rob Ellis wrote:
> On Wed, Aug 07, 2002 at 10:27:50AM -0500, Jack L. Stone wrote:
>> At 05:18 PM 8.7.2002 +0200, Siegbert Baude wrote:
>>> So, if anybody knows how to calculate the best value out of the
>>> technical parameters or can explain, why ~100k seems the best value (and
>>> not e.g. something in the area of disk cache size) I also would be very
>>> interested to hear.
>>> What is the maximum at all, one can expect? Is it possible to reach the
>>> maximum rate IBM claims for its disk with dd?
>>
>> Thanks for the follow-up on the "dd bs" side question. Clearly this
>> parameter makes a big difference as does the CPU speed, UDMA, etc. I too
>> would like to know of any way to calculate, but probably what you did by
>> trial is a good approach for each particular specific setup/environment.
>
> i chose 102400 also by trial and error -- a biggish number that might
> be a multiple of disk blocks. :-)
>
> smaller numbers made the dd slower, bigger numbers didn't seem to
> be making it significantly faster... but i wasn't being scientific.

The obvious intention is to minimize the number of transfers, so
theoretically the larger the transfer, the better.  The maximum I/O
transfer size is limited to the value of MAXPHYS, which is defined in
sys/param.h:

  #ifndef MAXPHYS
  #define MAXPHYS		(128 * 1024)	/* max raw I/O transfer size */
  #endif

The ATA subsystem uses this value.  Last time I looked, SCSI drives
were limited to 60 kB transfers, though this could have changed.  I
don't currently have any machine with SCSI disks connected, so I can't
confirm that.  A way to find is to run a command like

  dd if=/dev/da0c of=/dev/null bs=128k &

and in the background do an 'iostat da0 1'.  Here's an example with an
IDE drive:

  === grog@zaphod (/dev/ttyp0) ~ 3 -> iostat ad0 1
        tty             ad0             cpu
   tin tout  KB/t tps  MB/s  us ni sy in id
     0    3  5.19   7  0.03  11  0  4  1 84
     0  126 127.36 183 22.74   0  0  6  2 92
     0   44 128.00 190 23.76   0  0  2  0 98
     0   44 128.00 191 23.89   0  0  5  0 95
     0   44 128.00 191 23.88   0  0  7  1 92

As you can see, it's really doing 128 kB transfers, for an average
transfer rate of almost 24 MB/s.

Greg
--
When replying to this message, please copy the original recipients.
If you don't, I may ignore the reply.
For more information, see http://www.lemis.com/questions.html
See complete headers for address and phone numbers

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




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