1846167 Members
3446 Online
110254 Solutions
New Discussion

dd command

 
SOLVED
Go to solution
Javier Ortiz Guajardo
Frequent Advisor

dd command

we are using dd command to copy raw areas.

how can i determinate what block size i must use with dd command if we are using different kind of disks from source to destiny copy?
(faster disk to slow disk)
is the dd command the appropiate command to do this work?

thanks.
The obstacles are those things that the people see when they left to see their goals.
4 REPLIES 4
Pete Randall
Outstanding Contributor
Solution

Re: dd command

Javier,

Yes, the dd command is appropriate. The block size, however, depends. I usually start with bs=1024k at least and experiment from there. You can let it run for 60 seconds, kill it, and see how many blocks it copied. Then repeat with a larger block size to see if it improves.

Pete

Pete
William R Bowen
Advisor

Re: dd command

The best blocksize is really large. The blocksize for dd has nothing to do with the way the application might access the data. The default for dd is WAY TOO SMALL: 512 bytes. Using this blocksize, a 2Gb lvol might take an hour or two to copy. The speed of the two disks don't have any bearing on the choice.

I would pick bs=128k but you could use a larger size if you want. There won't be nearly as much performance increase as going from bs=512 to bs=128k by using bs=256k. A 2Gb disk volume will take a minute or two with bs=128k
James R. Ferguson
Acclaimed Contributor

Re: dd command

Hi:

First, of course, use the raw devices for your copy.

You can use 'diskinfo' to obtain the sector size of your disk. Then, from the 'dd' man page, note:

/begin_quote/

If 'if' or 'of' refers to a raw disk, 'bs' should always be a multiple of sector size of disk. The default 'bs' size used by 'dd' is 512 bytes. If sector size of disk is different from 512 bytes, a 'bs' multiple of sector size should be specified.

/end_quote/

The man pages also note that the most efficient copy will occur for equal blocksizes (in and out). I'd certainly choose a large multiple of the disk sector size, something like 256k.

Regards!

...JRF...
John Dvorchak
Honored Contributor

Re: dd command

If you are really concerned and wish to run a series of tests, don't forget about the timex command to let the computer time the transfer:

timex dd if=/dev/dsk/cxtxdx of=/dev/dsk/cytydy bs=128k

or

timex dd if=/dev/dsk/cxtxdx of=/dev/dsk/cytydy bs=256k

by the way the results I got was that selecting a block size of 128K or 256K was at least 10 times faster than not choosing a block size.
If it has wheels or a skirt, you can't afford it.