I was doing some test and practice of using ovftool to export and import ovf into a vm host.
Import a VM and rename the vm
ovftool --noSSLVerify --name="CentosBackup" --datastore=datastore1 --network="VM Network" C:\temp\CentOS\CentOS.ovf vi://email@example.com
--noSSLVerify is to suppress the certificate warning.
--datastore is to specify the datastore i want to put the vm.
--network is to specify the virtual network name i want the vm to use.
--name is a customize name of the imported vm, if this is not specify the name will be taken from the filename of the ovf you are trying to import.
Because I did not specify the
--diskMode the default is provision as thick.
So let’s try one more time to import with another name, though the ovf is the same file.
ovftool --noSSLVerify --name="CentosThinProv" --diskMode=thin --datastore=datastore1 --network="VM Network" C:\temp\CentOS\CentOS.ovf vi://firstname.lastname@example.org
This time the hdd space is according to how much was used.
Export ovf to a specified location
I want to export an existing vm known as siem, note that the vm name is case sensitive so Siem is not the same as siem.
ovftool --noSSLVerify vi://email@example.com/siem C:\temp
During the extraction I encountered a weird problem:
it says file not found, however I have verified that the spelling and the case of the word of the vm is the same, siem definitely exists.
The problem is that ovftool is trying to find the iso in the datastore apart from the vm i was trying to export, the virtual cd room of siem was set to datastore iso, so in order to fix this I need to change back to the Host device.
After i changed from “Datastore ISO file” to “Host device” I can continue to export.