Dex, nice research !  (-: 

A few comments: some details of what you found (and others commented
on) may depend on the intelligence built into the on-board disk controller
(re-mapping bad sectors, buffering I/O, ...) 

 - The default bs=512 matches a 'sector' (floppy disk, MBR) and also
should remain for backward compatibility of older custom scripts (or
custom scripts *should be* specific regarding defaults, (hmm, myself ...).

 - in case you are considering writing to the author of 'dd', please add
this on my behalf: The reported transferred data should not just be 'n+1
records in/out' but 'n blocks + xyz bytes in/out'  -- the prog knows 'xyx'
(so that's easy to implement), and such output would provide the user with
exact information w/o further doubts)

 - Horst

On Sat, 14 Dec 2002, Dexter Graphic wrote:

> Purpose:
> I wanted to find out what effect changing the block size (bs=)
> option of the dd command would have on partition copy speeds.
> I also wanted to confirm that the default block size (if no bs
> option was specified) was indeed 512 bytes as someone had said.
> Procedure:
> 1.) I used dd to completely fill up a 75MB partition with data 
> from a larger partition.
>   /dev/hda1 = Debian 3.0 root, ext3
>   /dev/hda3 = an empty, unformatted partition
>   command used = "dd if=/dev/hda1 of=/dev/hda3"
>   (Note: the above command stops copying and aborts once it has
>   used up all the available space on /dev/hda3.)
> 2.) I then copied this 75MB partition to an identical partition 
> on an identical drive using various block sizes and timing the
> process.
>   time dd if=/dev/hda3 of=/dev/hdb3 bs=xx
> Results:
>   no bs=              78s     144584+0 records
>   bs=512              78s     144584+0 records
>   bs=1k               38s     72292+0 records
>   bs=2k               38s     36146+0 records
>   bs=4k               38s     18073+0 records
>   bs=5k               39s     14458+1 records
>   bs=50k              38s     1445+1 records
>   bs=500k             39s     144+1 records
>   bs=512k             39s     144+1 records
>   bs=1M               39s     72+1 records
>   bs=5M               39s     14+1 records
>   bs=10M              39s     7+1 records
> Conclusions:
> 1. The default block size if no bs= option is specified is
> 512 bytes.
> 2. Any block size larger than the default (512 bytes) will 
> double the copy speed, but using larger block sizes will not 
> result in proportionately greater speed increases.
> 3. The output of dd shows the number of blocks (records) copied 
> plus (+) the number of partial blocks copied. From the above
> results I recalled that my hda1 partition was initialized using
> a 4k block size (which was the default block size in cfdisk).
> 4. The dd man page should be updated to include this basic 
> operational information (conclusions 1 thru 3) so that people
> don't have to run their own tests to figure out how to use it.
> 5. The dd code should *probably* be updated so that 4k is the 
> default block size rather than 512 bytes (since this seems to
> be the default block size on modern hard disks and it results
> in doubling of the copy speed.
> Dexter Graphic
> _______________________________________________
> Eug-LUG mailing list

Eug-LUG mailing list

Reply via email to