Scripting

Netcat And DD

Using dd and netcat to clone drives across a network...

To clone a drive on the same machine :

# dd if=/dev/hda of=/dev/hdb

This clones from hda to hdb

To clone onto a different machine

You need a boot disk with netcat and dd on it, along with drivers for any drive controllers and network cards. Then :

1. On the machine you want to clone :

# dd if=/dev/hda conv=sync,noerror bs=64k | nc -l -p 5000

2. On the machine you want to clone to :

# nc <ip of other pc> 5000 | dd of=/dev/hda bs=64k

To clone onto a different machine with compression (for big images...)

1. On the machine you want to clone :

# dd if=/dev/hda conv=sync,noerror bs=64k | gzip -c | nc -l -q 0 -p 5000

2. On the machine you want to clone to :

# nc 192.168.1.1 5000 | gzip -cd | dd of=/dev/hda bs=64k