Questions about the dd command

Neil hok.krat at gmail.com
Fri Feb 29 16:44:10 UTC 2008


On Fri, Feb 29, 2008 at 5:09 PM, elmo <elmo at ne.rr.com> 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?

It depends: using dd to copy the ubuntu instalation while running that
same installation could cause major problems, as files may be modified
while being copied. You should definitely use the CD to copy the OS.
If you just want to copy some other disk I'd advise you to run it from
the installation, since the installation is faster in most
applications.
Copying the OS itself to a new PC may cause all kind of problems,
because the hardware is too different (dunno, haven't tried. saw a
mate of mine do it on BSD to a laptop because the floppy drive was
lost, there were no USB connectors and no CDrom (to old....))

>
>   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?

Dunno, I suppose it could be echoed onto the screen with a script.
That would always decrease the speed a bit, but as these actions would
not need any disk access (if scripted correctly) that doesn't have to
be more than 1% or so.

>
>   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 bs number is the block size number. It is a tuning option. There
is a default value and it will work without it, albeit a couple of %
slower (no more than 10 I think).
The bs number is the number of bytes copied from the input file (if)
to the memory before dd starts copying the data to the output file
(of). It is a vital setting when working with raid 0/5/6 arrays, since
the bs has to be big enough to span all disks. In this case it
shouldn't matter much except when it is bigger than your RAM. A larger
bs tends to be a bit faster, as long as the RAM is sufficient.

Neil

-- 
There are two kinds of people:
1. People who start their arrays with 1.
1. People who start their arrays with 0.




More information about the ubuntu-users mailing list