Read-Only Mount on Linux

As of VDDK 6.7.1, read-only mount is supported on Linux, as it was previously on Windows. This section describes a Linux solution for earlier VDDK releases. Now applications can mount the base disk of a snapshot with the read-only flag.

Here are possible use cases for read-only mounting of virtual disks:
  • Avoid accidentally writing data to the disk, which is opened read/write mode.
  • Retain current disk data after the VM is powered off.
  • Use previous VM as a restore point by reverting to its original snapshot.

In VDDK 6.7.0 and before, Linux VixMntapi did not support read-only access. To mount a disk read-only, applications had to either mount the virtual disk of a powered off virtual machine, or mount the snapshot of a powered on virtual machine. The VixMntapi library can combine the two techniques to create read-only disk, as below.

To mount disks while saving a read-only copy:

  1. Power off the VM if it is on.
  2. Create a snapshot. Optionally revert to a previous snapshot if you want.
  3. Connect to the VM for read/write access with VixDiskLib_Connect or VixDiskLib_ConnectEx.
  4. Call VixMntapi_OpenDisks to open the current (not the snapshot) VM disk in read/write mode.
  5. Mount volumes to access files. Write operations can be performed, but they write to the redo log of the current VM disk, not to the snapshot.
  6. Close the disk and disconnect.
  7. Revert to the snapshot created in step 2, to eliminate any write changes. Delete the snapshot.
  8. Power on the VM if it was on before.