Virtual Disk Development Kit

 View Only
  • 1.  VMDK file to SAN block level LBA mapping : API ?

    Posted Sep 26, 2017 03:56 PM

    We were trying to see if there an API equivalent to get the following information via VDDK or any other library

    We are currently getting the mapping via vmkfstools using a hidden option "-t0" as shown below in the output, but we wanted to use this information in a reliable manner via an API so that later on if the output changes we do not get affected.. Or if the hidden option gets removed in future.

    [root@esxr520:/vmfs/volumes/56ec1423-3f0545b4-6c5b-001b215fe901/vm1] vmkfstools -t0 /vmfs/volumes/raidds520/vm13/vm13.vmdk
    Mapping for file /vmfs/volumes/raidds520/vm13/vm13.vmdk (64424509440 bytes in size):
    [           0:   536870912] --> [VMFS -- LVID:56ec1422-ea84df18-745c-001b215fe901/56ec1422-e4af496d-7fc1-001b215fe901/1:( 2157708312576 -->  2158245183488)]
    [   536870912:   536870912] --> [VMFS -- LVID:56ec1422-ea84df18-745c-001b215fe901/56ec1422-e4af496d-7fc1-001b215fe901/1:( 2158245183488 -->  2158782054400)]
    [  1073741824:   536870912] --> [VMFS -- LVID:56ec1422-ea84df18-745c-001b215fe901/56ec1422-e4af496d-7fc1-001b215fe901/1:( 2158782054400 -->  2159318925312)]
    [  1610612736:   536870912] --> [VMFS -- LVID:56ec1422-ea84df18-745c-001b215fe901/56ec1422-e4af496d-7fc1-001b215fe901/1:( 2159318925312 -->  2159855796224)]
    [  2147483648:   536870912] --> [VMFS -- LVID:56ec1422-ea84df18-745c-001b215fe901/56ec1422-e4af496d-7fc1-001b215fe901/1:( 2159855796224 -->  2160392667136)]
    [  2684354560:   536870912] --> [VMFS -- LVID:56ec1422-ea84df18-745c-001b215fe901/56ec1422-e4af496d-7fc1-001b215fe901/1:( 2160392667136 -->  2160929538048)]
    [  3221225472:   536870912] --> [VMFS -- LVID:56ec1422-ea84df18-745c-001b215fe901/56ec1422-e4af496d-7fc1-001b215fe901/1:( 2160929538048 -->  2161466408960)]
    [  3758096384:   536870912] --> [VMFS -- LVID:56ec1422-ea84df18-745c-001b215fe901/56ec1422-e4af496d-7fc1-001b215fe901/1:( 2161466408960 -->  2162003279872)]
    [  4294967296:   536870912] --> [VMFS -- LVID:56ec1422-ea84df18-745c-001b215fe901/56ec1422-e4af496d-7fc1-001b215fe901/1:( 2162003279872 -->  2162540150784)]
    [  4831838208:   536870912] --> [VMFS -- LVID:56ec1422-ea84df18-745c-001b215fe901/56ec1422-e4af496d-7fc1-001b215fe901/1:( 2162540150784 -->  2163077021696)]
    [  5368709120:   536870912] --> [VMFS -- LVID:56ec1422-ea84df18-745c-001b215fe901/56ec1422-e4af496d-7fc1-001b215fe901/1:( 2163077021696 -->  2163613892608)]
    [  5905580032:   536870912] --> [VMFS -- LVID:56ec1422-ea84df18-745c-001b215fe901/56ec1422-e4af496d-7fc1-001b215fe901/1:( 2163613892608 -->  2164150763520)]
    [  6442450944:   536870912] --> [VMFS -- LVID:56ec1422-ea84df18-745c-001b215fe901/56ec1422-e4af496d-7fc1-001b215fe901/1:( 2164150763520 -->  2164687634432)]
    [  6979321856:   536870912] --> [VMFS -- LVID:56ec1422-ea84df18-745c-001b215fe901/56ec1422-e4af496d-7fc1-001b215fe901/1:( 2164687634432 -->  2165224505344)]
    [  7516192768:   536870912] --> [VMFS -- LVID:56ec1422-ea84df18-745c-001b215fe901/56ec1422-e4af496d-7fc1-001b215fe901/1:( 2165224505344 -->  2165761376256)]

     

    [root@esxr520-stortrends:/vmfs/volumes/56ec1423-3f0545b4-6c5b-001b215fe901/vm1] vmkfstools -t0 /vmfs/volumes/raidds520/vm13/vm13.vmdk
    Mapping for file /vmfs/volumes/raidds520/vm13/vm13.vmdk (64424509440 bytes in size):
    [           0:   536870912] --> [VMFS -- LVID:56ec1422-ea84df18-745c-001b215fe901/56ec1422-e4af496d-7fc1-001b215fe901/1:( 2157708312576 -->  2158245183488)]
    [   536870912:   536870912] --> [VMFS -- LVID:56ec1422-ea84df18-745c-001b215fe901/56ec1422-e4af496d-7fc1-001b215fe901/1:( 2158245183488 -->  2158782054400)]
    [  1073741824:   536870912] --> [VMFS -- LVID:56ec1422-ea84df18-745c-001b215fe901/56ec1422-e4af496d-7fc1-001b215fe901/1:( 2158782054400 -->  2159318925312)]
    [  1610612736:   536870912] --> [VMFS -- LVID:56ec1422-ea84df18-745c-001b215fe901/56ec1422-e4af496d-7fc1-001b215fe901/1:( 2159318925312 -->  2159855796224)]
    [  2147483648:   536870912] --> [VMFS -- LVID:56ec1422-ea84df18-745c-001b215fe901/56ec1422-e4af496d-7fc1-001b215fe901/1:( 2159855796224 -->  2160392667136)]
    [  2684354560:   536870912] --> [VMFS -- LVID:56ec1422-ea84df18-745c-001b215fe901/56ec1422-e4af496d-7fc1-001b215fe901/1:( 2160392667136 -->  2160929538048)]
    [  3221225472:   536870912] --> [VMFS -- LVID:56ec1422-ea84df18-745c-001b215fe901/56ec1422-e4af496d-7fc1-001b215fe901/1:( 2160929538048 -->  2161466408960)]
    [  3758096384:   536870912] --> [VMFS -- LVID:56ec1422-ea84df18-745c-001b215fe901/56ec1422-e4af496d-7fc1-001b215fe901/1:( 2161466408960 -->  2162003279872)]
    [  4294967296:   536870912] --> [VMFS -- LVID:56ec1422-ea84df18-745c-001b215fe901/56ec1422-e4af496d-7fc1-001b215fe901/1:( 2162003279872 -->  2162540150784)]
    [  4831838208:   536870912] --> [VMFS -- LVID:56ec1422-ea84df18-745c-001b215fe901/56ec1422-e4af496d-7fc1-001b215fe901/1:( 2162540150784 -->  2163077021696)]
    [  5368709120:   536870912] --> [VMFS -- LVID:56ec1422-ea84df18-745c-001b215fe901/56ec1422-e4af496d-7fc1-001b215fe901/1:( 2163077021696 -->  2163613892608)]
    [  5905580032:   536870912] --> [VMFS -- LVID:56ec1422-ea84df18-745c-001b215fe901/56ec1422-e4af496d-7fc1-001b215fe901/1:( 2163613892608 -->  2164150763520)]
    [  6442450944:   536870912] --> [VMFS -- LVID:56ec1422-ea84df18-745c-001b215fe901/56ec1422-e4af496d-7fc1-001b215fe901/1:( 2164150763520 -->  2164687634432)]
    [  6979321856:   536870912] --> [VMFS -- LVID:56ec1422-ea84df18-745c-001b215fe901/56ec1422-e4af496d-7fc1-001b215fe901/1:( 2164687634432 -->  2165224505344)]
    [  7516192768:   536870912] --> [VMFS -- LVID:56ec1422-ea84df18-745c-001b215fe901/56ec1422-e4af496d-7fc1-001b215fe901/1:( 2165224505344 -->  2165761376256)]


  • 2.  RE: VMDK file to SAN block level LBA mapping : API ?

    Posted Sep 26, 2017 05:02 PM

    To have more clarity to what we are trying to achieve

    We were reading the lba 0 and length of 1 sector from a particular vmdk as shown in the command below

    C:\VMware-vix-disklib-6.0.0-2498720.x86_64\doc\sample\Debug>vixDiskLibSample.exe -dump -start 0 -count 1 -host "10.40.0.4" -user administrator@vsphere.local -password xxxxx -libdir "C:\VMware-vix-disklib-6.0.0-2498720.x86_64" -thumb xx:xx:xx -initex "vddk.config" -mode san -ssmoref "snapshot-4586" -vm "moref=vm-4585" "[vm1] vm1_clone/vm1_clone-000003.vmdk"

     

    When tracing the WireShark, the VDDK translated it to LBA 0x0597e000 which is 93839360 on the SAN.

    242 7.108743 10.50.0.31 10.50.12.32 iSCSI 102 SCSI: Read(10) LUN: 0x00 (LBA: 0x0597e000, Len: 1)

    This also matches with the start lba reported by vmkfstools 48045752320 ( bytes ) - > 93839360 (sector )

    [root@esxr520:/vmfs/volumes/56ec1423-3f0545b4-6c5b-001b215fe901/vm1] vmkfstools -t0 /vmfs/volumes/vm1/vm1_clone/vm1_clone-000003.vmdk

    Mapping for file /vmfs/volumes/vm1/vm1_clone/vm1_clone-000003.vmdk (64424509440 bytes in size):

    [           0:   536870912] --> [VMFS -- LVID:59c95a94-2c6c5327-fd6d-001b215fe901/59c95a94-14c5603d-248a-001b215fe901/1:( 48045752320 -->  48582623232)]

     

    So that lba conversion map is what we are trying to get from VDDK. VDDK is able to get the map using some API. We need to know which API it is or if its exposed

     

    2
     
     
    42 7.108743 10.50.0.31 10.50.12.32 iSCSI 102 SCSI: Read(10) LUN: 0x00 (LBA: 0x0597e000, Len: 1)


  • 3.  RE: VMDK file to SAN block level LBA mapping : API ?
    Best Answer

    Posted Sep 29, 2017 06:17 PM

    We were able to get the Data structures and APIs used for the same by traversing through VCServiceInstance



  • 4.  RE: VMDK file to SAN block level LBA mapping : API ?

    Posted Oct 19, 2017 03:36 PM

    Could you tell us where in the MOB you figured this out?



  • 5.  RE: VMDK file to SAN block level LBA mapping : API ?

    Posted Oct 24, 2017 09:18 PM

    How to browse the internal vSphere APIs

    This link was what led us to the same