Usage Message

Running the sample application without arguments produces the following usage message:

Usage: vixdisklibsample command [options] diskPath
commands:
 -create : creates a sparse virtual disk with capacity specified by -cap
 -redo parentPath : creates a redo log 'diskPath' for base disk 'parentPath'
 -info : displays information for specified virtual disk
 -dump : dumps the contents of specified range of sectors in hexadecimal
 -fill : fills specified range of sectors with byte value specified by -val
 -wmeta key value : writes (key,value) entry into disk's metadata table
 -rmeta key : displays the value of the specified metada entry
 -meta : dumps all entries of the disk's metadata
 -clone sourcePath : clone source vmdk possibly to a remote site
 -readbench blocksize: do read benchmark on a disk using the specified I/O block size in sectors
 -writebench blocksize: do write benchmark on disk using the specified I/O block size in sectors
options:
 -adapter [ide|scsi] : bus adapter type for 'create' option (default='scsi')
 -start n : start sector for 'dump/fill' options (default=0)
 -count n : number of sectors for 'dump/fill' options (default=1)
 -val byte : byte value to fill with for 'write' option (default=255)
 -cap megabytes : capacity in MB for -create option (default=100)
 -single : open file as single disk link (default=open entire chain)
 -multithread n: start n threads and copy the file to n new files
 -host hostname : hostname / IP addresss (ESXi or vCenter)
 -user userid : user name on host (default = root)
 -password password : password on host
 -port port : port to use to connect to host (default = 443)
 -vm vmPath=/path/to/vm : inventory path to vm that owns the virtual disk
 -libdir dir : Directory containing vixDiskLibPlugin library
 -initex configfile : Use VixDiskLib_InitEx
 -ssmoref moref : Managed object reference of VM snapshot
 -mode mode : Mode string to pass into VixDiskLib_ConnectEx
 -thumb string : Provides a SSL thumbprint string for validation

The -thumb option is a new security-related feature in the VDDK 5.1 release. See SSL Certificate Thumbprint.

The sample program’s -single option, which opens a single link instead of the entire disk chain, is supported for (local) hosted disk, but not for (remote) managed disk.

To connect to an ESXi host with the sample program, you must specify the options -host, -user, -password, and provide a diskPath on the ESXi host’s datastore. For example:

vix-diskLib-sample -info -host esx5 -user root -password secret "[datastore1] <VM>/<VM>.vmdk"

To connect to vCenter Server, you must also specify the options -libdir and -vm. Programs need libdir so the DiskLibPlugin can connect with vCenter Server, which must locate the VM. For example:

vix-diskLib-sample -info -host vc5 -user Administrator -password secret 
                -libdir <pluginDir> -vm vmPath=<path/to/VM> "[<partition>] <VM>/<VM>.vmdk"

The vmPath is formulated in vSphere Client by starting at vCenter and inserting /vm/ before the VM name. The diskPath is ascertained by clicking Edit Settings > Hard Disk and copying the Disk File name.

vix-disklib-sample -info -host vc5 -user Administrator -password secret 
                -libdir /usr/lib/vmware-vix-disklib/lib64 -vm vmPath=Datacenter/vm/RHEL5 
                "[datastore1] RHEL5/RHEL5.vmdk"

To connect using an advanced transport, for example to virtual machine disk on SAN storage, you must also specify the options -mode and -ssmoref. The transport mode and managed object reference (of a snapshot) are required for VixDiskLib_ConnectEx(). To find the ssmoref, log in to the managed object browser for the vCenter Server, and click content > rootFolder > Datacenter > datastore > vm > snapshot. A snapshot must exist, because it is a bad idea to open the base disk of a powered-on VM.

vix-disklib-sample -info -host vc5 -user Administrator -password secret -mode san 
                -libdir /usr/lib/vmware-vix-disklib/lib64 -vm vmPath=Datacenter/vm/RHEL5 
                -ssmoref snapshot-72 "[datastore1] RHEL5/RHEL5.vmdk"

On Windows, the VDDK package installs diskLibPlugin.dll in the \bin folder, not the \lib folder, so change <pluginDir> accordingly.