blocksize when using dd to copy disks? bigger = better?
fbsd06 at mlists.homeunix.com
Tue Sep 23 21:17:24 UTC 2008
On Tue, 23 Sep 2008 11:37:00 -0400
Jerry McAllister <jerrymc at msu.edu> wrote:
> On Tue, Sep 23, 2008 at 11:04:13AM -0400, Joachim Rosenfeld wrote:
> > When mirroring a disk with dd, I notice that a blocksize of 512 runs
> > awfully slow, but with bs=1MB (2^10bytes), it runs fairly quickly.
> > Can someone explain the implications of this? Did all the data not
> > copy properly with the larger blocksize?
> If you are on a beach moving sand and you pick up one grain at a
> time and move it, it will take a very long time because the overhead
> of moving yourself is much higher than the amount of sand moved.
> If you use the largest bucket or scoop that you can handle, then
> it goes much faster because the same body motions result in much
> more being moved. Moving data has a similar dynamic.
I tried playing around with this once, and I found that the speed rose
rapidly up to a certain blocksize, then levelled-out for a decade or so
and then dropped to half of the peak speed. IIRC in that particular case
the optimum range was something like 20k-200k.
I presume what happens is that you can make the blocksize too big for
the other buffering, and end-up alternating reads and writes rather
than doing them in parallel.
More information about the freebsd-questions