dd / nc netcat disk clone over SSH

ssh root@sourcehost 'dd if=/dev/sda'| dd of=/dev/target status=progress

Source: https://www.maketecheasier.com/ssh-pipes-linux/

Combined with the rsync tip, to copy 32 GB:

dd if=/dev/sda status=progress bs=4M count=8192 | ssh -T -c arcfour -o Compression=no -x user@targethost 'dd of=/folder/on/target/file.img'

Got 42,5 MB/s with this from SSD to HDD over 1 Gbit.

Verify the file

dd if=/dev/sda status=progress bs=4M count=8192|md5sum

md5sum /folder/on/target/file.img

Netcat - higher speed, unencrypted

On the source:
cat /path/to/source | pv | nc -l -p 5555

On the target:
nc <source-host> 5555 | pv > /path/to/target

Speeds were ~10-90 MB/s with this method.

This is a personal note. Last updated: 2019-06-22 12:09:28.


Don't forget to pay my friend a visit too. Joakim