Linux.com

Excellent!

Posted by: Anonymous Coward on November 14, 2005 10:29 PM
I also agree that this was very well written. I discovered good 'ol "nc" a couple of years ago, and it's come in handy many, many times.


Particularly at work, where my team all has identical machines (and the company has opted for somewhat unreliable/cheap computers from a large computer company which had merged with another large computer company a couple years ago), this has come in handy. When we have a hardware failure (and our team of 5 developers have had 8 of them in 18 months), we simply clone one of our working machines to the replacement. It's as simple as booting Knoppix on both and doing:


on the new machine "nc -l -p 1234 | dd of=/dev/sda" (or<nobr> <wbr></nobr>/dev/hda or whatever is your hard drive)


on the old machine "dd if=/dev/sda | nc IP_ADDRESS 1234" (substitute IP_ADDRESS for the machine you're sending to)


You can throw in a pipe to gzip if you want to compress before sending, or you can use a similar command to make an image of your entire hard disk to a file (which, after so many failures, we have done so we don't need to take another machine down to make a copy).

#

Return to CLI Magic: netcat