Export (0) Print
Expand All

ExpandVirtualDisk function

Increases the size of a fixed or dynamically expandable virtual hard disk (VHD).

Syntax


DWORD ExpandVirtualDisk(
  _In_      HANDLE VirtualDiskHandle,
  _In_      EXPAND_VIRTUAL_DISK_FLAG Flags,
  _In_      PEXPAND_VIRTUAL_DISK_PARAMETERS Parameters,
  _In_opt_  LPOVERLAPPED Overlapped
);

Parameters

VirtualDiskHandle [in]

A handle to the open virtual disk, which must have been opened using the VIRTUAL_DISK_ACCESS_METAOPS flag. For information on how to open a virtual disk, see the OpenVirtualDisk function.

Flags [in]

Must be the EXPAND_VIRTUAL_DISK_FLAG_NONE value of the EXPAND_VIRTUAL_DISK_FLAG enumeration.

Parameters [in]

A pointer to a valid EXPAND_VIRTUAL_DISK_PARAMETERS structure that contains expansion parameter data.

Overlapped [in, optional]

An optional pointer to a valid OVERLAPPED structure if asynchronous operation is desired.

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.

Remarks

The ExpandVirtualDisk function performs the operation in-place, and therefore does not create a virtual disk.

The expand operation is valid only for fixed and expandable virtual disks and will invalidate a differencing virtual disk chain.

Expanding a virtual disk requires that the virtual disk be detached during the operation.

The caller must have READ|WRITE access to the backing store for the virtual disk.

For an expandable virtual disk, the ExpandVirtualDisk function may not result in a larger file because the size is virtual and would not actually grow physically until used.

If the virtual disk is expandable and the host volume does not have enough space for the new size, the ExpandVirtualDisk function can succeed anyway. Future writes to the virtual disk may fail if the host volume runs out of space as the virtual disk expands.

Requirements

Minimum supported client

Windows 7

Minimum supported server

Windows Server 2008 R2

Header

VirtDisk.h (include Windows.h)

Library

VirtDisk.lib

DLL

VirtDisk.dll

See also

About VHD
VHD Reference

 

 

Build date: 10/26/2012

Community Additions

ADD
Show:
© 2014 Microsoft