VMware vSphere

 View Only
  • 1.  Convert dd-Image (SAS, Windows) to ESXi6 VMDK

    Posted Feb 28, 2017 07:00 PM

    All,

    I've taken a whole disk image with dd of a Windows server which uses SAS for its C: Boot drive.

    I'm trying to convert this image to VMDK for an ESXi 6 host.

    qemu-img doesn't seem to be capable, at least if it isn't a SATA image. There's an option for SAS but it doesn't work. There are errors like

    Unsupported or invalid disk type 2 for 'scsi:0.0'. Ensure that the disk has been imported.

    1. What's best practice? Of course, I could boot a live distro and dd the image to a new machine disk.

    2. Is there any support for dd RAW-format? It's very easy to handle with KVM, but seems to be unsupported in ESXi.

    3. If I want to extract the disk description contained in the VMDK: is there any tool? To edit the description and separate it from data?

    - Chris



  • 2.  RE: Convert dd-Image (SAS, Windows) to ESXi6 VMDK

    Posted Feb 28, 2017 08:16 PM

    Welcome to the Community,

    If I want to extract the disk description contained in the VMDK: is there any tool?

    If the image contains a .vmdk descriptor, then it is no raw image, but e.g. a Workstation virtual disk format, which isn't supported on ESXi hosts. In this case you need to convert it to an ESXi virtual disk format, which should be possible by running s.th. like:

    vmkfstools -i source.vmdk target.vmdk

    (or vmware-vdiskmanager ... on VMware Workstation)

    André



  • 3.  RE: Convert dd-Image (SAS, Windows) to ESXi6 VMDK
    Best Answer

    Posted Mar 01, 2017 04:14 AM

    >> I've taken a whole disk image with dd of a Windows server which uses SAS for its C: Boot drive.
    Did you create that image with dd using a command like:
    dd if=/dev/sda of=diskimage.dd bs=1M
    ?
    If yes then you actually already have a valid flat.vmdk file without descriptor.
    Rename it to diskimage-flat.vmdk
    Get the values for the specified parameters and use this sample.
    Troubleshooting:
    if datastorebrowser displays 2 files - you have a syntax error
    if not - all good

    # esxi-descriptorfile
    # replace XXX with size of flat.vmdk in bytes divided by 512

    # replace YYY with XXX devided by 16065 rounded down

    # replace ZZZ with path to flat.vmdk

    # when done - cut here and save file

    ########################################

    # Disk DescriptorFile

    version=1

    encoding="UTF-8"

    CID=12345678

    parentCID=12345678

    createType="vmfs"

    # Extent description

    RW XXX VMFS "ZZZ"

    # The Disk Data Base

    #DDB

    ddb.adapterType = "lsilogic"

    ddb.geometry.cylinders = "YYY"

    ddb.geometry.heads = "255"

    ddb.geometry.sectors = "63"

    ddb.virtualHWVersion = "8"


    if your diskimages was created likedd if=/dev/sda1 of=diskimage.dd bs=1M

    then you need one extra step.Create descriptor as before.Create a new vmdk at least 1MB larger than diskimage.
    Use a dummy LinuxVM with two virtual disks

    scsi.0.0-file = newly created.vmdk

    and

    scsi.0.1-fileName =diskimage.vmdk

    First boot into Linux LiveCD.

    Partition the disk as required then dump diskimage into appropriate partition
    dd if=/dev/sdb if=/dev/sda1 bs=1M conv=notrunc

    The whole procedure is quite easy - you only need to be sure that you have a dd-compatible image that uses no extra-headers or compression.
    The GUI-approaches that exist - may be easier to use but the mentioned variant is the most reliable way to do this.

    Ulli












  • 4.  RE: Convert dd-Image (SAS, Windows) to ESXi6 VMDK

    Posted Mar 28, 2017 05:13 PM

    Thank you for your replies. It worked fine.