convert VMX to OVF using OVFtool

て烟熏妆下的殇ゞ 提交于 2019-12-04 05:15:08

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!

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

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

Try to run as described below.

C:\Program Files\VMware\VMware OVF Tool>ovftool C:\Win-Test\Win-Test.vmx(location of your vmx file) C:\Win-Test\win-test.ovf (destination)

KP Rahul

Maybe ovftool is unable to recognize the path you are giving.

Try with following command:

ovftool --eula@=[path to eula] --X:logToConsole --targetType=OVA --compress=9 vi://[username]:[ESX address] [target address]

Once you provide the ESX address, it will list down the folders you have created in your ESX box. Then you can trigger the command above mentioned again with appending folder name.

If no folder hierarchy present in your box, then it will simply list down vm names.

Retry the same command appending [foldername]/[vmname no vmx file name required]

ovftool --eula@=[path to eula] --X:logToConsole --targetType=OVA --compress=9 vi://[username]:[ESX address]/[foldername if exist]/[vmname no vmx file name required] [target address]

I had this same exact issue. In my case I opened up the VMX file and dropped the IDE and sound controllers from the file and saved. I was then able to convert everything to an OVA using the tool with the standard syntax.

e.g. I dropped:

ide1:0.present = "TRUE"
ide1:0.deviceType = "cdrom-image"

and:

sound.present = "TRUE"
sound.fileName = "-1"
sound.autodetect = "TRUE"

This allowed me to convert the file like normal.

For me opening the .vmx and deleting the following line worked:

sata0:1.deviceType = "cdrom-image"
Jordan

In my case, this works:

ide1:0.present = "TRUE"

ide1:0.deviceType = "cdrom-image"

I did change true to false and works fine, as cdrom-image not exist, this change permit the format conversion.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!