Skip to content

Instantly share code, notes, and snippets.

@zhanglongqi
Last active June 10, 2021 08:10
Show Gist options
  • Save zhanglongqi/c1ad277a59fcb9a35dd3fa4d76b5b754 to your computer and use it in GitHub Desktop.
Save zhanglongqi/c1ad277a59fcb9a35dd3fa4d76b5b754 to your computer and use it in GitHub Desktop.
Clone disk partition using dd over telnet with bzip compression

Thanks to https://www.thegeekdiary.com/how-to-clone-linux-disk-partition-over-network-using-dd/

Clone using telnet and bzip has advantages to reduce clone time, but make sure you use a secure network.

Lets assume server-B has ip address 192.168.100.2 Run this command in server B (destination):

# nc -l -p 19000 | bzip2 -d | dd bs=16M of=/dev/sda

Run this command in server A (source):

# dd bs=16M if=/dev/sda | bzip2 -c | nc 192.168.100.2 19000

Based on these 2 commands above we will connect to server-B using port 19000.

It's better not to use bzip2 if you are backing up embedded system because the CPU may be too slow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment