1

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?

3

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.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.