Programming with VixMntapi
At the top of your program, include vixMntapi.h along with any other header files you need. Structures and type definitions are declared in the include file, so you do not need to create them or allocate memory for them.
Call VixMntapi_Init() to initialize the library in your application. This function takes major and minor version number to account for future extensions. You can provide your own logging, warning, or panic functions to substitute for the default VixMntapi handlers, and custom library and temporary directories.
Call VixMntapi_OpenDiskSet() to open a set of virtual disks for mounting. Pass a set of disk handles obtained from the VixDiskLib_Open() call. The VixMntapi_OpenDiskSet() function also expects number of disks to open, an optional open mode, and a parameter to pass back the resulting disk-set handle.
File System Support
Traditional Windows file systems (including FAT, FAT32, and NTFS) are supported. ReFS is supported but read-only for VixMntapi. Linux file systems (including ext2, ext3, ext4) are supported if the proxy machine supports them. VixMntapi depends on an operating system for file attributes such as compression, encryption, hidden files, ACL, and alternate streams. If a vixMntapi-linked application runs on a virtual machine that supports these attributes, vixMntapi can support them. Windows basic volumes and simple dynamic volumes are supported for writing, but spanned, striped (RAID-0), mirrored (RAID-1) and parity (RAID-5) volumes are supported read-only for VixMntapi.
You must open a disk set read/write to obtain the OS information for dynamic volume types including LDM and LVM. If you cannot open a base disk read/write, create a child disk in front, and open it read/write. In a multi-boot setup, only the first entry #0 is opened.
The order of mounting is important. For instance, mount top-level directories before subdirectories, and drives with dependencies after drives that they depend on. Mount points are not enumerated, nor are they restored. When you mount one volume, the other volumes are not implicitly mounted also.
Read-Only Mount on Linux
Linux vixMntapi does not support read-only access. It is explicitly disabled in the code due to journal replay requirements when mounting ext3 and later file systems. To mount a disk read-only, you must either mount the virtual disk of a powered off virtual machine, or mount the snapshot of a powered on virtual machine. Here are possible use cases for read-only virtual disk mounts:
The VixMntapi library can emulate mounting disks read-only, as in the Linux procedure below. A similar procedure could be used on Windows.
To mount disks while saving a read-only copy
1
2
3
Connect to the VM with VixDiskLib_Connect or VixDiskLib_ConnectEx for read/write access.
4
Call VixMntapi_OpenDisks to open the current (not the snapshot) VM disk in read/write mode.
5
6
7
8