XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    VDI export to VMDK results in a corrupted disk

    Scheduled Pinned Locked Moved Solved Xen Orchestra
    15 Posts 3 Posters 139 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A Online
      abudef
      last edited by

      2a23be37-665b-4827-896a-a20545061b00-image.jpeg

      1 Reply Last reply Reply Quote 0
      • DanpD Offline
        Danp Pro Support Team
        last edited by

        Have you attempted to analyze the exported file using qemu-img?
        For example:

        qemu-img info file.vmdk
        qemu-img check file.vmdk
        
        1 Reply Last reply Reply Quote 0
        • A Online
          abudef
          last edited by abudef

          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.

          1 Reply Last reply Reply Quote 0
          • DanpD Offline
            Danp Pro Support Team
            last edited by

            It's possible that the issue lies within VMware Workstation. ๐Ÿคท

            1 Reply Last reply Reply Quote 0
            • A Online
              abudef
              last edited by

              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.

              1 Reply Last reply Reply Quote 0
              • A Online
                abudef
                last edited by

                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     โ”‚
                โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                
                1 Reply Last reply Reply Quote 0
                • A Online
                  abudef
                  last edited by abudef

                  Ah, I see it now. What XO exports is the streamOptimized format, 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 monolithicSparse e.g.:

                  qemu-img.exe convert -p -f vmdk -O vmdk -o subformat=monolithicSparse WS25.vmdk WS25-2.vmdk
                  
                  Emmanuel VE 1 Reply Last reply Reply Quote 0
                  • A abudef has marked this topic as solved
                  • A Online
                    abudef
                    last edited by

                    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.

                    1 Reply Last reply Reply Quote 0
                    • Emmanuel VE Offline
                      Emmanuel V Vates ๐Ÿช XCP-ng Team @abudef
                      last edited by

                      It might be worth adding a message in XO at export, or in the documentation ?

                      A 1 Reply Last reply Reply Quote 0
                      • A Online
                        abudef @Emmanuel V
                        last edited by

                        @Emmanuel-V In my opinion, it would make more sense if a standalone disk exported in VMDK format were exported directly as monolithicSparse, so that it would not need to be converted. This makes more sense to me because when only the disk is exported, rather than the entire VM (OVA), it can be assumed that the disk will be attached directly to some VM.

                        1 Reply Last reply Reply Quote 0

                        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
                        • First post
                          Last post