Wednesday 22 February 2012

Wanna move or copy virtual machine over WAN?

What do you usually do to copy or move over WAN link from one site to another? How do you do it if the remote site is 5000 miles away and you have only 2Mb E1 link between sites?

Normally, I would copy VM from a datastore to, for instance, local disk on vCenter server. Then I would copy VM files to a server at a remote site and once copy process is over I will copy the files from the server at the remote site to the datastore at the remote site. Not the most elegant and fastest method, but it worked for me.

However, yesterday we faced a situation when we needed to copy VM over 2Mbit link. VM had thin disk with 120 GB provisioned disk space and 7 GB of actual allocated disk space. Obviously, regular way of moving files wouldn't work here for very simple reason - once you copy VM with thin disks to NTFS partition those disks are converted to thick type. Thus, I would have to copy 120 GB over 2 Mb link which in ideal scenario could take me about 7 days.

Sure, the very first thought I had was to use VMware Converter to changed provisioned disk space to the actual one. However, it wasn't the most convenient way. Failed twice for me because I overlooked couple of the settings in wizard. That's when my colleague advised me to try OVA/OVF
.
Well, for me OVA/OVF was always a standard of multiple virtual appliances I import into vSphere, but I never thought about this format as of a way of exporting and moving VM around (Yes, I know, I am narrow minded person).

Once I tested OVF import/export operations I found 4 cool advantages:

1. It is really really simple. Shut down VM, go to File - Export - Export OVF Template, choose between OVA or OVF and where to save the VM. That's it.

2. It does save only actual data. So, you don't have have a problem of disks being converted to thick once they are copied to NTFS.

3. It compresses VM very well.
If you use GUI wizard you can't select compression rate, but in my situation I got 1.3 Gb OVA file out of VM with 7 Gb allocated disk space. You can download and install VMware OVF tool which will provide you with command line for OVA/OVF operations and way more of options, including different compression rates.

Just to check how good the compression rate is I exported couple more of VMs and both of them were compressed to have of the original size of actual used storage. 

4. Not sure if it works for all filesystems and OS, but when I exported my Linux VM to OVA file and then imported it back it shrinked the thin disk to the actual size. So, this might be useful, for instance, for situations when you copied big amount of data to VM with thin disks and afterwards you delete this data leaving thin  disk inflated but not efficiently used.


N. B.  Be careful with VMs running some kind of licensing services which are tightly bound to VM's mac address or some other type of ID of virtual hardware because when you import OVF you get VM with new virtual hardware, so virtual machine OS has to adjust itself.

If you find this post useful please share it with any of the buttons below. 

3 comments:

  1. Thanks. You confirmed my hope. I have to migrate 4 VMs (~60GB, thick provisioned) to AWS using OVA but none are anywhere near using the full provisioned size.

    ReplyDelete
  2. This is highly informatics, crisp and clear. I think that everything has been described in systematic manner so that reader could get maximum information and learn many things. Best Copy Machines for Business

    ReplyDelete
  3. thanks for each certainly one of space informative web site. The vicinity else might also simply I accumulate that satisfactory of sponsorship written in such a perfect means? i've a challenge that Im simply now lively nearly, and i've been on the see out for such safety. photostat machine

    ReplyDelete