[olug] Cheap ghost alternative...

Trent Melcher trentm at q.com
Wed Jun 2 16:58:11 UTC 2010


I use dd and nc all the time for cloning drives across systems, works great.

You can use SystemResuceCD "http://www.sysresccd.org" to boot a Linux kernel
to use these tools, its one CD I never leave home without, LOL :)  

Lately I just have a bootable USB thumbdrive but for older systems that
don't boot from USB still gotta keep a CD handy.


-----Original Message-----
From: olug-bounces at olug.org [mailto:olug-bounces at olug.org] On Behalf Of Dan
Sent: Wednesday, June 02, 2010 8:54 AM
To: Omaha Linux User Group
Subject: [olug] Cheap ghost alternative...

Over the weekend I needed to copy the partitions of one virtual machine to
another over the network (moving HDDs wasn't an option).  For some reason I
couldn't quickly find a free tool to do this (I thought the gparted tools
use to do this...) but I found a page showing how to use NetCat and DD:

Source machine:
  dd if=/dev/sda | nc $DEST_IP $DEST_PORT -q10

Destination Machine @ DEST_IP
  nc -l $DEST_PORT | dd of=/dev/sda

I was getting ~8MB/sec on in-home lan switch.

To make the transfer more visible and see the speed in real-time, use the
"pv" program - Pipe View.  It goes in-line between the nc and dd commands to
show speed of data with output like this:
    1.61GB 0:08:11 [7.63MB/s] [      <=>                                ]

Place "| pv" between the nc and dd commands like this:
  dd if=/dev/sda | pv | nc $DEST_IP $DEST_PORT -q10

I didn't try this, but they also suggested to use "gzip" between nc and dd
to compress network bandwidth:
 - source: dd .... | gzip  -cf | nc ...
 - destination: nc ... | gzip -dfc | dd ...

Combining them all together:
  dd if=/dev/sda | pv | gzip -cf | nc $DEST_IP $DEST_PORT -q10
Should show the rate of the raw data being sent across the network.

Hope someone else finds this useful.


P.S. I booted from a Ubuntu ISO 10.04 image which has dd, nc, and gzip by
default - I had to install pv using apt-get IIRC.

***************** ************* *********** ******* ***** *** **
"Quis custodiet ipsos custodes?"
   (Who can watch the watchmen?)
   -- from the Satires of Juvenal
"I do not fear computers, I fear the lack of them."
   -- Isaac Asimov (Author)
** *** ***** ******* *********** ************* *****************
OLUG mailing list
OLUG at olug.org

More information about the OLUG mailing list