dd is a command-line utility for Unix and Unix-likeoperating systems, the primary purpose of which is to convert and copy files.
Secure Shell (SSH) is a cryptographic network protocol for operating network services securely over an unsecured network. Typical applications include remote command-line login and remote command execution, but any network service can be secured with SSH.
The point is, you know what your target is, this tutorial tries to be as short as possible.
Imagine you have 2 server, A and B, both equipped with disk sda and sdb. To make it simple, just ignore the size problem for now.
To copy from /dev/sda in server A to /dev/sdb in server B, use this command on server A.
dd if=/dev/sda | ssh [email protected] "dd of=/dev/sdb"
To copy /dev/sdb in server A to block file /tmp/file.img at server B, use this command on server A.
dd if=/dev/sda | ssh [email protected] "dd of=/tmp/file.img"
Need progress bar? use pv. Install it, here’s the guide for ubuntu/debian
apt-get update && apt-get install pv
Then pipe it to pv.
dd if=/dev/sda | pv | ssh [email protected] "dd of=/tmp/file.img"
Feeling poor on bandwidth? Make use of gzip!
dd if=/dev/sda | pv | gzip | ssh [email protected] "gunzip | dd of=/tmp/file.img"
That concludes everything.