The sample program presented in Virtual Disk API Sample Code creates virtual disk of type
MONOLITHIC_SPARSE, in other words one big file, not pre-allocated. This is the default because modern file systems, in particular NTFS, support files larger than 2GB, and can hold more than 2GB of total data. This is not true of legacy file systems, such as FAT16 on MS-DOS and early Windows, or the ISO9660 file system for writing files on CD, or NFS version 2, or Linux kernel 2.4. All are limited to 2GB per volume. FAT and FAT32 were extended to 4GB in NT 3.51.
However, a SPLIT virtual disk might be safer than the
MONOLITHIC variety, because if something goes wrong with the underlying host file system, some data might be recoverable from uncorrupted 2GB extents. VMware products do their best to repair a damaged VMDK, but having a split VMDK increases the chance of salvaging files during repair. On the downside,
SPLIT virtual disk involves higher overhead (more file descriptors) and increases administrative complexity.
When required for a FAT16 or early Linux file system, you can create SPLIT_SPARSE virtual disk. The change is simple: the line highlighted in boldface. The sample program could be extended to have an option for this.
This one-line change to DoCreate() causes creation of 200MB split VMDK files (200MB being the capacity set on the previous line) unless the
-cap command-line argument specifies otherwise.
As stated in Support for Managed Disk,
VixDiskLib_Create() does not support managed disk. To create a managed disk on the remote ESXi host, first create a hosted disk on the local Workstation, then convert the hosted disk into managed disk with
VixDiskLib_Clone() over the network.
In this call, appGlobals.connection and
appGolbals.diskPath represent the remote VMDK on the ESXi host, while
srcConnection and
appGlobals.srcPath represent the local hosted VMDK.
On Workstation, the VixVMPowerOn() function in the VIX API does this. For ESXi hosts, you must use the
PowerOnVM_Task method. As easy way to use this method is in the VMware vSphere Perl Toolkit, which has the
PowerOnVM_Task() call (non-blocking), and the
PowerOnVM() call (synchronous).