MirrorVirtualDisk function (virtdisk.h)

Initiates a mirror operation for a virtual disk. Once the mirroring operation is initiated it will not complete until either CancelIo or CancelIoEx is called to cancel all I/O on the VirtualDiskHandle, leaving the original file as the current or BreakMirrorVirtualDisk is called to stop using the original file and only use the mirror. GetVirtualDiskOperationProgress can be used to determine if the disks are fully mirrored and writes go to both virtual disks.

Syntax

DWORD MirrorVirtualDisk(
  [in] HANDLE                          VirtualDiskHandle,
  [in] MIRROR_VIRTUAL_DISK_FLAG        Flags,
  [in] PMIRROR_VIRTUAL_DISK_PARAMETERS Parameters,
  [in] LPOVERLAPPED                    Overlapped
);

Parameters

[in] VirtualDiskHandle

A handle to the open virtual disk. For information on how to open a virtual disk, see the OpenVirtualDisk function.

[in] Flags

A valid combination of values from the MIRROR_VIRTUAL_DISK_FLAG enumeration.

Value Meaning
MIRROR_VIRTUAL_DISK_FLAG_NONE
0x00000000
The mirror virtual disk file does not exist, and needs to be created.
MIRROR_VIRTUAL_DISK_FLAG_EXISTING_FILE
0x00000001
Create the mirror using an existing file.

[in] Parameters

Address of a MIRROR_VIRTUAL_DISK_PARAMETERS structure containing mirror parameter data.

[in] Overlapped

Address of an OVERLAPPED structure. This parameter is required.

Return value

Status of the request.

If the function succeeds, the return value is ERROR_SUCCESS.

If the function fails, the return value is an error code. For more information, see System Error Codes.

Requirements

Requirement Value
Minimum supported client Windows 8
Minimum supported server Windows Server 2012
Target Platform Windows
Header virtdisk.h
Library VirtDisk.lib
DLL VirtDisk.dll

See also

MIRROR_VIRTUAL_DISK_FLAG

MIRROR_VIRTUAL_DISK_PARAMETERS

VHD Functions