Modifying OVF Files to Adjust Virtual Disk Size, CPU, and Memory
When importing VMware OVA/OVF files, you may encounter issues such as:
- Virtual disks defined with extremely large capacity (e.g., 2–3 TB empty disks). Even if the disk is Thin Provisioned, ESXi/Workstation still requires the full potential space to be available.
- The default CPU or memory settings don’t meet your requirements and need to be changed before deployment.
- Import errors stating that the Host Client cannot deploy compressed disks (streamOptimized), requiring either
ovftool
or manual adjustments.
This post documents how to manually edit OVF files to solve these issues.
1. File Structure Overview
A typical OVF package includes: – .ovf
: the XML descriptor file of the virtual machine
– .vmdk
: virtual disk files (one or more)
– .mf
: manifest file containing file checksums (optional)
The file we need to edit is the .ovf
.
2. Adjusting Virtual Disk Capacity
Inside the <DiskSection>
you might see something like:
<Disk ovf:capacity="2048" ovf:capacityAllocationUnits="byte * 2^30" ovf:diskId="vmdisk2" ovf:fileRef="file2" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" ovf:populatedSize="0" />
ovf:capacity="2048"
→ maximum disk size = 2048 GiB (~2 TB)ovf:populatedSize="0"
→ actual populated size = 0
How to Modify
If you only need 200 GB instead of 2 TB, change it to:
<Disk ovf:capacity="200" ovf:capacityAllocationUnits="byte * 2^30" ovf:diskId="vmdisk2" ovf:fileRef="file2" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" ovf:populatedSize="1048576" />
- The disk maximum capacity is now 200 GiB.
populatedSize
is set to 1 MB (1048576 bytes) instead of 0, which avoids validation errors during import.
3. Adjusting CPU Settings
In the <VirtualHardwareSection>
, CPU is represented by ResourceType=3
:
<Item> <rasd:ResourceType>3</rasd:ResourceType> <rasd:VirtualQuantity>2</rasd:VirtualQuantity> </Item>
Here the VM is configured with 2 CPUs.
How to Modify
Change <rasd:VirtualQuantity>
to the desired number, e.g., 4:
<Item> <rasd:ResourceType>3</rasd:ResourceType> <rasd:VirtualQuantity>4</rasd:VirtualQuantity> </Item>
4. Adjusting Memory Settings
Memory is represented by ResourceType=4
, with units in MB:
<Item> <rasd:ResourceType>4</rasd:ResourceType> <rasd:VirtualQuantity>65536</rasd:VirtualQuantity> </Item>
This example sets memory to 65536 MB (64 GB).
How to Modify
If you only want 8 GB, set it to 8192:
<Item> <rasd:ResourceType>4</rasd:ResourceType> <rasd:VirtualQuantity>8192</rasd:VirtualQuantity> </Item>
5. Manifest File (.mf
) Handling
If your OVF directory includes an .mf
file, it contains SHA1/SHA256 checksums of the OVF and VMDKs.
- After editing the
.ovf
, the manifest will become invalid. - Options:
- Simplest: delete the
.mf
file and import without it (works in most ESXi environments). - Alternatively: regenerate the
.mf
with updated checksums usingsha256sum
(Linux) orcertutil
(Windows).
6. Import Testing
Once the OVF is modified:
- Place the
.ovf
file and.vmdk
files in the same directory. - Delete the old
.mf
if you didn’t regenerate it. - Use ESXi Host Client to import the new
.ovf
.
Now the VM will be created with: – Disk 2 = 200 GB Thin Provisioned
– CPU = 4 cores
– Memory = 8 GB
7. Summary
Editing OVF files allows you to customize VM specifications when:
– The provided OVA defines excessively large disks.
– You need to adjust CPU and memory before deployment.
– Populated size must be non-zero to avoid validation errors.
– The manifest file must be removed or regenerated.
✍️ These notes are based on my experience fixing a vendor-provided OVF that originally required 3 TB of storage just to import, even though only a few GB were actually needed.
Recent Comments