Exporting VMWare Server VMs to OVA/OVF with ovftool

Well, I thought this was going to be a huge pain in the ass, but it turns out not to be a really big deal. I found this post which includes instructions and a link to download VMWare’s “ovftool”. There’s a win32 version and a 32-bit and 64-bit linux version:

-rwxr--r-- 1 evan evan 19326184 Sep 11 17:16 VMware-ovftool-installer-1.0.0-166674-lin.i386.sh*
-rwxr--r-- 1 evan evan 17212108 Sep 11 17:16 VMware-ovftool-installer-1.0.0-166674-lin.x86_64.sh*
-rwxr-xr-x 1 evan evan 43833393 Sep 11 17:33 jdk-1_5_0_13-linux-amd64.bin*

I installed JDK 1.5.0_r13 because that’s what I had laying around. The 64-bit installer for ovftool ran without a hitch. I haven’t yet tried importing the .ova to my vCenter cluster (the export was from our Vmware Server (free) environment) but the conversion itself seemed fine. The one problem I encountered was that it was complaining that the cdrom was connected. The VM in question had an ISO configured as its cdrom drive, but it wasn’t connected, yet the ovftool still complained about it. I shutdown the VM, deleted the device completely, and then the conversion went fine.

[root@thardus ~]# /opt/vmware/ovftool/ovftool /nfsroot/VM/Monitoring/Monitoring.vmx /nfsroot/OVF/test.ova
Opening VMX source: /nfsroot/VM/Monitoring/Monitoring.vmx
Opening OVA target: /nfsroot/OVF/test.ova
Target: /nfsroot/OVF/test.ova
Disk Transfer Completed
Completed successfully

The whole thing took about 10-15 minutes I guess for a 20 gig VM. Actually that’s another interesting thing: the source directory with the VMDKs was ~20 gigs:

[root@thardus ~]# du -sh /nfsroot/VM/Monitoring/
21G     /nfsroot/VM/Monitoring/

But the OVA that was created was only 2.5 gigs.

[root@thardus ~]# ls -lh /nfsroot/OVF/test.ova
-rw------- 1 root root 2.5G Sep 11 18:45 /nfsroot/OVF/test.ova

I assume this is due to compression and only including the parts of the VMDK that have actual data (basically thinly provisioning it). I haven’t restored yet, which would be the real test, but so far it looks like it’s a pretty easy tool that does what it’s supposed to.

Update 2009-11-25: With the current version of ovftool you can’t create .ova files with ovftool for VMDKs larger than 8 gb. See this post on the VMware forums for more info.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s