VDI export to VMDK results in a corrupted disk
-
Ah... ok. I think I originally checked the VM export.
This could be a bug. Does it occur with all VDIs? What happens if you try to import the file back into XO?
-
I tried to export 3 VDIs from 2 different XCP-ng pools. 2 VDIs from Windows Server 2025 VMs and 1 from Windows Server 2022 VM. All 3 VMDKs seem to be corrupted when I try to use them in VMware Workstation.
I also tried reimporting 1 of the exported VMDKs back into the XCP-ng repository and the VM booted without any issue using the reimported VDI.
Maybe there is either an issue with this VMDK format in VMware Workstation or the XOΒ΄s export/import method creates VMDK files that can be exported and reimport back into XCP-ng repository while preserving the original state of the VDI in the XCP-ng repository even if itΒ΄s unusable in VMware WS.
-
P poddingue marked this topic as a question
-

-
Have you attempted to analyze the exported file using qemu-img?
For example:qemu-img info file.vmdk qemu-img check file.vmdk -
qemu-img.exe info Windows Server 2025.vmdk image: Windows Server 2025.vmdk file format: vmdk virtual size: 64G (68719476736 bytes) disk size: 64G cluster_size: 65536 Format specific information: cid: 2849992906 parent cid: 4294967295 create type: streamOptimized extents: [0]: compressed: true virtual size: 68719476736 filename: Windows Server 2025.vmdk cluster size: 65536 format:qemu-img.exe check Windows Server 2025.vmdk No errors were found on the image.It seems that the disk itself is formally OK, but the content is somehow corrupted.
-
It's possible that the issue lies within VMware Workstation.

-
I don't think it's a VMware issue. If the XO export created a VMDK with incorrect data block contents, qemu-img check can still complete without reporting any errors. It only means that it did not find any problems with the VMDK structure.
-
IΒ΄m not a developer so I asked Ai what it "thinks" about it...
βββββββββββββββ β XCP-ng VDI β ββββββββ¬βββββββ β β VDI_exportContent() β format = VDI_FORMAT_VHD βΌ ββββββββββββββββββββ β VHD stream β ββββββββββ¬ββββββββββ β β vhdToVMDK() βΌ βββββββββββββββββββββββββββ β vhdToVMDKIterator() β βββββββββββββ¬ββββββββββββββ β β parseVhdToBlocks() βΌ βββββββββββββββββββββββββββ β parseVhdStream() β β β β VHD blocks β β { id, data } β βββββββββββββ¬ββββββββββββββ β β onlyBlocks() β β lba = id * blockSize βΌ ββββββββββββββββββββββββββββββββββββββββββ POSSIBLE ERROR HERE Incorrect mapping of id β data or incorrect block ordering ββββββββββββββββββββββββββββββββββββββββββ β βΌ βββββββββββββββββββββββββββ β generateVmdkData() β β β β VHD block β β β β β grainData β β β β β createMarkedGrain() β β β β β tableBuffer β βββββββββββββ¬ββββββββββββββ β βΌ ββββββββββββββββββββ β VMDK stream β ββββββββββ¬ββββββββββ β βΌ ββββββββββββββββββββ β VMDK file β ββββββββββββββββββββ -
Ah, I see it now. What XO exports is the
streamOptimizedformat, which is used in OVAs for transfer. Such a standalone VMDK cannot be used directly and needs to be converted for both VMware Workstation and ESXi
, or you can use the OVA import, which performs the conversion automatically.So before such a VMDK can be attached to a VMware VM, it needs to be converted to
monolithicSparsee.g.:qemu-img.exe convert -p -f vmdk -O vmdk -o subformat=monolithicSparse WS25.vmdk WS25-2.vmdk -
A abudef has marked this topic as solved
-
So in the end, I think the best approach is to export the VHD and convert it, because the conversion has to be done anyway, and the native VHD export is faster.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register Login