Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

convert VMX to OVF using OVFtool

I am trying to convert VMX to OVF format using OVFTool as below, however it gives error:

C:\Program Files\VMware\VMware OVF Tool>ovftool.exe
vi://vcenter.com:port/folder/myfolder/abc.vmx abc.ovf
Error: Failed to open file: https://vcenter.com:port/folder/myfolder/abc.vmx
Completed with errors

Please let me know if you have any solution.

like image 984
Aditi S Avatar asked Jun 08 '15 17:06

Aditi S


3 Answers

I had a similar situation in vmware fusion trying to use a .vmx that was probably created on windows. I could boot the VM, but any attempt to export the machine with ovftool or use vmware-vdiskmanager bombed out with:

Error: Failed to open disk: source.vmdk
Completed with errors

the diskname was totally valid, path was valid, permissions were valid, and the only clue was running ovftool with:

ovftool --X:logToConsole --X:logLevel=verbose source.vmx dest.ova

Opening VMX source: source.vmx
verbose -[10C2513C0] Opening source
verbose -[10C2513C0] Failed to open disk: ./source.vmdk
verbose -[10C2513C0] Exception: Failed to open disk: source.vmdk. Reason: Disk encoding error
Error: Failed to open disk: source.vmdk

as others suggested, i took a peek in the .vmdk. therein i found 3 other clues:

encoding="windows-1252"
createType="monolithicSparse"
# Extent description
RW 16777216 SPARSE "source.vmdk"

so first i converted the monolithicSparse vmdk to "preallocated virtual disk split in 2GB files":

vmware-vdiskmanager -r source.vmdk -t3 foo.vmdk

then i could edit the "foo.vmdk" to change the encoding, which now looks like:

encoding="utf-8"
createType="twoGbMaxExtentFlat"
# Extent description
RW 8323072 FLAT "foo-f001.vmdk" 0
RW 8323072 FLAT "foo-f002.vmdk" 0
RW 131072 FLAT "foo-f003.vmdk" 0

and finally, after fixing up the source.vmx:

scsi0:0.fileName = "foo.vmdk"

profit:

ovftool source.vmx dest.ova
...
Opening VMX source: source.vmx
Opening OVA target: dest.ova
Writing OVA package: dest.ova
Transfer Completed
Completed successfully
like image 50
Ryan Breed Avatar answered Sep 20 '22 14:09

Ryan Breed


I had a similar problem with OVFTool trying to export to OVF format.

Export failed: Failed to open file: C:\Virtual\test\test.vmx.

First, I opened .VMX file in editor (it's a text file) and made sure that settings like

scsi0:0.fileName = "test.vmdk"
nvram = "test.nvram"
extendedConfigFile = "test.vmxf"

mention proper file names. Then I noticed this line:

.encoding = "windows-1251"

This is Cyrillic code page, so I modified it to use Western code page

.encoding = "windows-1252"

Then, running OVFTool gave a different error

Export failed: Failed to open disk: test.vmdk.

To fix it I had to open .VMDK file in HEX editor (because it's usually a big binary file), found there the string

encoding = "windows-1251"

(it's somewhere in the beginning of the file), and replaced "1251" with "1252".

And it did the trick!

like image 20
Vladimir Shutow Avatar answered Sep 20 '22 14:09

Vladimir Shutow


In my case, was needed repair the disk 'abc.vmdk' before convert the 'abc.vmx' to 'abc.ovf'.

Use this for Linux:

$ /usr/bin/vmware-vdiskmanager -R /home/user/VMware/abc.vmdk

Look this link https://kb.vmware.com/s/article/2019259 for resolved issue in Windows and Linux

like image 44
guilhermisaac Avatar answered Sep 18 '22 14:09

guilhermisaac