October 22, 2017 | 10:02 pm
You are here:  / First Time / HOWTO / [HOWTO] Use dd and netcat to copy a partition to a remote machine

[HOWTO] Use dd and netcat to copy a partition to a remote machine

If you want to make a partition image on another machine:

on source machine:

dd if=/dev/hda bs=16065b | netcat targethost-IP 1234

on target machine:

netcat -l -p 1234 | dd of=/dev/hdc bs=16065b

Netcat is a program, available by default, on almost every linux installation. It is like a swiss army knife of networking. In the preceding example netcat and dd are piped to one another. One of the functions of the linux kernel is to make pipes. The pipe character looks like two little lines on top of one another, both vertical. Here is how this command behaves:

On the source machine dd is told to read /dev/hda with a byte size which is kind of weird. This byte size is a cylinder. bs=16065b equals one cylinder on an LBA drive. Ok, then the dd command is piped to netcat, which takes as its arguments the IP address of the target(like 192.168.0.1, or any IP address with an open port) and what port you want to use(1234). Don’t hit enter yet. Type the command for the target machine first, hit enter on the target machine, hit enter on the source machine. Now the bit stream copy will take place. This is kind of how Norton Ghost works to image a drive to another machine.

via How To Do Eveything With DD – LinuxQuestions.org.

Tags: