question

Neha-2272 avatar image
0 Votes"
Neha-2272 asked LimitlessTechnology-2700 answered

OVA equivalent for Hyper-V

In Vmware we have an option of importing the vm using .ova or .ovf files where we dont have to provide any configuration details like memory while creating vm. On similar lines we have .vhdx image which we use to create new VMs in Hyper V by providing RAM and other configuration details and using "Use an existing virtual hard disk" option. The disadvantage of this is we have to create a new copy of vhdx image each time a new vm has to be created. We wanted to know if there is any way we can have an image similar to .ova which we can simply use to create a vm in hyper V ?

windows-server-hyper-v
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

LimitlessTechnology-2700 avatar image
0 Votes"
LimitlessTechnology-2700 answered

Hi Neha-2272,

There's no equivalent file to .ova within Hyper-V. The two systems are similar in many ways, but this is not one of them. If you have a .ova file, there is a method for converting .ova files to Hyper-V VHDs. The following process should allow you to do this:

Step 1: 1. Produce the .vmdk file you are trying to convert.
I downloaded the VeeamPN OVA from the Veeam website. From the OVA archive (VeeamPN_2.0.0.435.ova), extract the vmdk file (VeeamPN-2.0.0.435-disk1.vmdk). I used 7zip.

Step 2: 2. Gather the required tools.
To proceed, you will need the following:

A. Windows 8.0/Server 2012 or later. Win7 does not support the required commands.

B. Microsoft Virtual Machine Converter 3.x.

https://www.microsoft.com/en-us/download/details.aspx?id=42497

Run the msi file to install the files. By default, they will install into C:\Program Files\Microsoft Virtual Machine Converter.

C. A sector editor. I use two tools from the dsfok toolkit.

https:// www. mysysadmintips .com/-downloads-/Windows/Servers/dsfok.zip

Step 3: 3. Attempt the conversion.
Open Powershell (run as administrator).

Import the modules. (This shows the default install location.)

Import-Module C:\Program Files\Microsoft Virtual Machine Converter\MvmcCmdlet.dll

Run the conversion. It will probably fail.
Step 4: 4. Examine the error message to identify the problematic field.
The Microsoft converter seems to choke on certain descriptor fields in the vmdk file. Nearly all my conversions fail with a message similar to this:

ConvertTo-MvmcVirtualHardDisk : The entry 0 is not a supported disk database entry for the descriptor.

Step 5: Extract the descriptor record using the dsfo.exe utility.
dsfo.exe D:\PathToVMDK\disk1.vmdk 512 1024 D:\PathToVMDK\descriptor.txt

This extracts 1024 bytes beginning at offset 512 to a file you can modify with any text editor.

Step 6: 6. Remove the problematic descriptor.
Examine the disk database section of the file.

The Disk Data Base DDB
ddb.adapterType = lsilogic ddb.deletable = true ddb.geometry.cylinders = 2088 ddb.geometry.heads = 255 ddb.geometry.sectors = 63 ddb.longContentID = d9e839a4e9d09afb211bcaa5cdc6f038 ddb.toolsInstallType = 0 ddb.toolsVersion = 2147483647 ddb.virtualHWVersion = 13

Look for a line that is referenced by the error. In this case, the The entry 0 is not a supported disk database entry. We can identify it as the ddb.toolsInstallType = 0 entry.

Remove the offending line. Add the exact number of spaces at the end of the last text entry in the file to keep the file length the same.

Write the changed sector back with the dfsi.exe utility.

dsfi.exe D:\PathToVMDK\disk1.vmdk 512 1024 D:\PathToVMDK\descriptor.txt

Step 7: 7. Re-run the PowerShell command to covert the file.
PS C:\ova> ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath .\VeeamPN-2.0.0.435-disk1.vmdk -DestinationLiteralPath . -VhdType DynamicHardDisk -VhdFormat Vhdx

Destination Source

C:\ova\VeeamPN-2.0.0.435-disk1.vhdx .\VeeamPN-2.0.0.435-disk1.vmdk

And the conversion completes successfully. If it does not, repeat the process. In some cases, I have had to remove up to three descriptors.

This procedure is not the most convenient and it doesn't have a GUI. But it does work when other programs have failed.





--If the reply is helpful, please Upvote and Accept as answer--

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.