views:

204

answers:

2

I have two twins CentOS 5.4 servers with VMware Server installed on each.

What is the most reliable and fast method for copying virtual machines files from one server to the other, assuming that I always use sparse file for my vmware virtual machines?

The vm's files are a pain to copy since they are very large (50 GB) but since they are sparse files I think something can be done to improve the speed of the copy.

+1  A: 

Have you tried rsync with the option --sparse(possibly over ssh)?

From man rsync:

    Try  to  handle  sparse  files  efficiently so they take up less
    space on the destination.  Conflicts with --inplace because it’s
    not possible to overwrite data in a sparse fashion.
ChristopheD
Note: the poster asked about CentOS machines, so the Solaris-is-broken bit is probably unnecessary.
Conrad Meyer
True (removed that bit), good point.
ChristopheD
A: 

If you want to copy large data quickly, rsync over SSH is not for you. As running an rsync daemon for quick one-shot copying is also overkill, yer olde tar and nc do the trick as follows.

Create the process that will serve the files over network:

tar cSf - /path/to/files | nc -l 5000

Note that it may take tar a long time to examine sparse files, so it's normal to see no progress for a while.

And receive the files with the following at the other end:

nc hostname_or_ip 5000 | tar xSf -

Alternatively, if you want to get all fancy, use pv to display progress:

tar cSf - /path/to/files \
   | pv -s `du -sb /path/to/files  | awk '{ print $1 }'` \
   | nc -l 5000

Wait a little until you see that pv reports that some bytes have passed by, then start the receiver at the other end:

nc hostname_or_ip 5000 | pv -btr | tar xSf -
mrts