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:
- Power off the VM if it is on.
- Create a snapshot. Optionally revert to a previous snapshot if you want.
- Connect to the VM for read/write access with VixDiskLib_Connect or VixDiskLib_ConnectEx.
- Call VixMntapi_OpenDisks to open the current (not the snapshot) VM disk in read/write mode.
- 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.
- Close the disk and disconnect.
- Revert to the snapshot created in step 2, to eliminate any write changes. Delete the snapshot.
- Power on the VM if it was on before.