If you have a fully fledged VM environment which has an Enterprise licence, then moving virtual machines from one datasource to another is trivial, as VMotion can mange this easily. But if you are using the free ESX version or perhaps don't have shared storage, then VMotion is not an option. It should be possible to use a tool like Veeam to backup a VM and then restore it to a new location but another way is to use the (free) VM OVF tool. To get a copy of this go to the VMware site and using you (free) account - or create one - download the latest version. As of early 2023, that is 4.4.3 and it's available for Linux, Windows 64 and W32. If you using VMware 8.x then 4.5.0 is the current version and can be found here. There is also good information on Github.
OVFTOOL is a cli peice of code which runs on a workstation and is then pointed at either an ESX host or VCenter. Turning an existing VM into an OVF package is easy, and an example would look like this. [Note ovftool is case sensitive, even when running on Windows and should be run from an elevated cmd prompt.]
C:Program FilesVMwareVMware OVF Tool>ovftool.exe vi://192.168.0.6/"Macrium Testbed" nas-02ISO
Enter login information for source vi://192.168.0.6/
Username: root
Password: ************
Opening VI source: vi://[email protected]:443/Macrium%20Testbed
Opening OVF target: nas-02ISO
Writing OVF package: nas-02ISOMacrium TestbedMacrium Testbed.ovf
Disk progress: 75%
So in the example above, a powered off (and the VM must always be powered off for ovftool to run, unlike VMotion) called 'Macrium Testbed' stored on a host (not the VCenter) is packed up and stored on a NAS drive, nas-02 in the ISO folder.
And the result is 4 files as seen above.
The next part of the operation would be to restore that ovf package to a new location, such as a new server with local storage or a remote location.
Here things get trickier. The easiest way is to restore to a VCenter instance, probably by bouncing off the ESX host. One will also need to specifiy the DataStore, DataCenter and Host. So the command would look like this:
C:Program FilesVMwareVMware OVF Tool>ovftool -ds="LL-01" "nas-02isoMacrium TestbedMacrium Testbed.ovf" vi://[email protected]:[email protected]/Datacenter/host/192.168.0.6/
Opening OVF source: nas-02isoMacrium TestbedMacrium Testbed.ovf
The manifest validates
Opening VI target: vi://administrator%[email protected]:443/Datacenter/host/192.168.0.6/
Deploying to VI: vi://administrator%[email protected]:443/Datacenter/host/192.168.0.6/
Transfer Completed
Completed successfully
So the host is 192.168.0.6, VCenter is 192.168.0.7, the Datacenter is Datacenter and the DataStore is LL-01. Again, all case sensitive.
At the end of this the VM can be powered up and tested.
Other issues:
We kept running into a problem when trying to restore this test OVF with an error popping up 'not found _deviceImage-0.iso
'
Error:
- File ds:///vmfs/volumes/5ebc561b-aaf27140-1664-14187736f463/_deviceImage-0.iso was not found
Completed with errors
No idea what this is caused by but it could be fixed by creating a text file named _deviceImage-0.iso and uploading it to the root of the datastore. Perhaps some 'ghost' of an ISO from some point in the VMs history..?
Another issue is in systems where the host is controlled by a VCenter machine and one tries to restore directly to the host. This is not allowed.
Opening VI target: vi://[email protected]:443/
Error:
- Access to resource settings on the host is restricted to the server that is managing it: '192.168.0.7'.
Completed with errors
So in this case, ***6 is the host and ***7 is the VCenter. Hence the notes above showing how to go 'via' VCenter.
To see what objects are available on a host, try:
C:Program FilesVMwareVMware OVF Tool>ovftool.exe vi://192.168.0.6/
Enter login information for source vi://192.168.0.6/
Username: root
Password: ************
Error: Found wrong kind of object (ResourcePool). Possible completions are:
W-2022
W10-21H1
W11-21H2
WM-DC01
WM-AP02
This one we never could solve, but worked around:
C:Program FilesVMwareVMware OVF Tool>ovftool -ds=LL-01 -n="Macrium Testbed" "nas-02isoMacrium TestbedMacrium Testbed.ovf" vi://192.168.0.6/
Opening OVF source: nas-02isoMacrium TestbedMacrium Testbed.ovf
The manifest validates
Error: Internal error: Failed to connect to remote host [192.168.0.6] due to [No version for VMODL calls to <<last binding: <<TCP '192.168.0.156 : 38712'>, <TCP '192.168.0.6 : 443'>>>, /sdk>]
Completed with errors
And using ovftool on its own against a previously made ovf returns lots of good stuff:
:Program FilesVMwareVMware OVF Tool>ovftool.exe "nas-02isoMacrium TestbedMacrium Testbed.ovf"
OVF version: 1.0
VirtualApp: false
Name: Macrium Testbed
Download Size: 43.84 GB
Deployment Sizes:
Flat disks: 100.00 GB
Sparse disks: 79.09 GB
Networks:
Name: VM Network
Description: The VM Network network
Virtual Machines:
Name: Macrium Testbed
Operating System: windows8server64guest
Virtual Hardware:
Families: vmx-14
Number of CPUs: 2
Cores per socket: 2
Memory: 4.00 GB
Disks:
Index: 0
Instance ID: 10
Capacity: 100.00 GB
Disk Types: SCSI-lsilogicsas
NICs:
Adapter Type: E1000e
Connection: VM Network
References:
File: Macrium_Testbed-disk1.vmdk
File: Macrium_Testbed-file1.nvram
C:Program FilesVMwareVMware OVF Tool>
Links
As always, built on the shoulders of others, including these:
https://blah.cloud/virtualisation/deploying-ovaovf-remote-vcenter-using-ovftool/
https://firstwave.com/blogs/getting-started-converting-the-ovf-for-vmware-vcenter/
https://developer.vmware.com/web/tool/4.4.0/ovf