Questions about the dd command

Marius Gedminas marius at pov.lt
Fri Feb 29 16:39:43 UTC 2008


On Fri, Feb 29, 2008 at 11:09:09AM -0500, elmo wrote:
> I've spent literally hours trying to find direct answers on the dozens 
> of websites that discuss 'dd'
> but the couldn't find what I wanted.
> 
> A few questions about the ' dd ' command:
> 
>   For example:     sudo dd if=/dev/sda2 of=/dev/sdb2 bs=1440
> 
>   1. Which is preferrable;    execute the command from an installed
>        ubuntu (/dev/sda2) or from a ubuntu CD?

CD.  If you run it while the system is running, it may change the
contents of /dev/sda2 in the middle of the operation, and you'll end up
with an inconsistent copy.

>   2. How do you  modify the example  to show the data as it is being 
> copied? 
>      Would this have a drastic effect on how long it takes to complete 
> the copy
>       compared to just watching a blinking cursor?

You can't, easily.  Run killall -USR1 from a different terminal to see
the current progress whenever you get bored.  Or estimate the time to
copy by dividing the partition size by the transfer speed

Run vmstat 1 and observe the bi/bo columns to see the current read/write
speed in kilobytes per second.

>   3.  What effect on the does the ' bs = ' number have on
>       the time to complete the copy or the accuracy of the copy?  Is 
> there a
>       default number if the the bs=    is omitted from the command?

The default number is 512 bytes.  Using a 1KB block size can be twice as
fast.  When I played with it (running dd with various block sizes and
watching the I/O speed with vmstat), I didn't see any further speedups
with larger block sizes.

Block size has no effect on the accuracy.  dd will copy the partial block
at the end of the partition correctly, even if the block size doesn't
divide the size of the partition.

HTH,
Marius Gedminas
-- 
You have moved the mouse. NT must be restarted for the changes to take effect.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20080229/2d3d78d6/attachment.pgp>


More information about the ubuntu-users mailing list