I have a local machine that needs be migrated to remote disk. How can I do it with dd? I know local format for command

dd if=/dev/sdx of=/dev/sdx count=x bs=x

But how to do it via ssh direct from local to remote?

1 Answer 1


You should run two instances of dd in that case, one in the local host and the other one on the remote host (through ssh.)

To make that work, you would omit the of= argument, to have dd write the blocks to stdout (which you can write to a pipe), or omit if= to read from stdin (from a pipe.)

For example, copying from local to remote:

dd if=/dev/sdx bs=x count=x |
    ssh user@host dd of=/dev/sdx bs=x

Or to copy from remote to local:

ssh user@host dd if=/dev/sdx bs=x count=x |
    dd of=/dev/sdx bs=x

You likely want to use matching bs= settings on both sides (though technically that's not strictly necessary.)


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .