Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Convert from ESXi vmdk image to raw

Avatar of muff
muffFlag for Australia asked on
VMwareVirtualization
18 Comments1 Solution6735 ViewsLast Modified:
Hello,

I have a VMWare virtual appliance I would like to use under Xen (not XenServer).  In order to do this, I need to first convert the vmdk disk to something Xen can understand, so I am going with raw to keep things simple.  

Here is the disk definition from the ovf:

    <References>
        <File ovf:id="file1" ovf:href="disk1.vmdk" ovf:size="58685952" />
    </References>
    <Section xsi:type="ovf:DiskSection_Type">
        <Info>Describes the set of virtual disks</Info>
        <Disk ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:capacity="107374182400" ovf:format="http://www.vmware.com/specifications/vmdk.html#sparse" ovf:populatedSize="117178368" />
    </Section>

[...snip...]
            <Item>
                <rasd:Caption>Hard Disk 1</rasd:Caption>
                <rasd:Description />
                <rasd:InstanceId>6</rasd:InstanceId>
                <rasd:ResourceType>17</rasd:ResourceType>
                <rasd:HostResource>/disk/vmdisk1</rasd:HostResource>
                <rasd:Parent>7</rasd:Parent>
                <rasd:AddressOnParent>0</rasd:AddressOnParent>
            </Item>
            <Item>
                <rasd:Caption>SCSI Controller 0</rasd:Caption>
                <rasd:Description>LsiLogic SCSI Controller</rasd:Description>
                <rasd:InstanceId>7</rasd:InstanceId>
                <rasd:ResourceType>6</rasd:ResourceType>
                <rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
                <rasd:BusNumber>0</rasd:BusNumber>
            </Item>

So my first step is to convert the disk from whatever format it is into a standard vmdk, then qemu-img it to raw:

vmware-vdiskmanager -r disk1.vmdk -t 0 temporary_image.vmdk
qemu-img convert -f vmdk temporary_image.vmdk -O raw xen_compatible.img

This results in an expect 100GB file.  I am expecting this to be a disk image with partition information, but parted shows no partition:

parted xen_compatible.img
WARNING: You are not superuser.  Watch out for permissions.
GNU Parted 1.9.0
Using xen_compatible.img
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Model:  (file)
Disk xen_compatible.img: 107GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start  End  Size  Type  File system  Flags

And just mounting it doesn't work:

mount -o loop xen_compatible.img /mnt/temp
mount: you must specify the filesystem type

Now what I don't have is a VMWare ESX server to see what this disk is really made up of.  Any ideas how I can convert this?

Paul
ASKER CERTIFIED SOLUTION
Avatar of coolsport00
Commented:
This problem has been solved!
Unlock 1 Answer and 18 Comments.
See Answers