using dd to copy my freebsd partion to another drive
Jack L. Stone
jackstone at sage-one.net
Sun May 25 12:37:12 PDT 2003
At 12:05 PM 5.25.2003 -0400, D Velez wrote:
>Hi, I would like to know what would be the best
>block size to use when using the dd command.
>I read many web pages on how to use the dd
>command, but all have different block sizes
>and I am confuse. I see some as bs=512 bs=1024
>bs=8192, etc....
>
>Is there a way to calculate the block size of the
>two hard drives myself or is there a standard
>block size to use for any hard drive, cdrom and floppy.
>
>I appreciate your help
>
>Thanks
>
>David V
>
This has been discussed quite a bit on the list. Here's one of those that
should help you see what your computer wants according to the I/O:
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. 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
sageame at sagec$ dd if=/dev/ad0c of=/dev/null bs=128k &
sageame at sagec$ top -I
dd if=/dev/ad0c of=/dev/null bs=128k &
and in the background do an 'iostat ad0 1'. Here's an example with an
IDE drive:
=== grog at 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.
Best regards,
Jack L. Stone,
Administrator
SageOne Net
http://www.sage-one.net
jackstone at sage-one.net
More information about the freebsd-questions
mailing list