CREATE_VIRTUAL_DISK_PARAMETERS structure

Contains virtual hard disk (VHD) creation parameters, providing control over, and information about, the newly created virtual disk.

Syntax


typedef struct _CREATE_VIRTUAL_DISK_PARAMETERS {
  CREATE_VIRTUAL_DISK_VERSION Version;
  union {
    struct {
      GUID      UniqueId;
      ULONGLONG MaximumSize;
      ULONG     BlockSizeInBytes;
      ULONG     SectorSizeInBytes;
      PCWSTR    ParentPath;
      PCWSTR    SourcePath;
    } Version1;
    struct {
      GUID                   UniqueId;
      ULONGLONG              MaximumSize;
      ULONG                  BlockSizeInBytes;
      ULONG                  SectorSizeInBytes;
      PCWSTR                 ParentPath;
      PCWSTR                 SourcePath;
      OPEN_VIRTUAL_DISK_FLAG OpenFlags;
      VIRTUAL_STORAGE_TYPE   ParentVirtualStorageType;
      VIRTUAL_STORAGE_TYPE   SourceVirtualStorageType;
      GUID                   ResiliencyGuid;
    } Version2;
  };
} CREATE_VIRTUAL_DISK_PARAMETERS, *PCREATE_VIRTUAL_DISK_PARAMETERS;

Members

Version

A value from the CREATE_VIRTUAL_DISK_VERSION enumeration that is the discriminant for the union.

ValueMeaning
CREATE_VIRTUAL_DISK_VERSION_1
1

Use the Version1 member of this structure.

CREATE_VIRTUAL_DISK_VERSION_2
2

Use the Version2 member of this structure.

 

Version1

This structure is used if the Version member is CREATE_VIRTUAL_DISK_VERSION_1 (1).

UniqueId

Unique identifier to assign to the virtual disk object. If this member is set to zero, a unique identifier is created by the system.

MaximumSize

The maximum virtual size, in bytes, of the virtual disk object. Must be a multiple of 512.

If a ParentPath is specified, this value must be zero.

If a SourcePath is specified, this value can be zero to specify the size of the source virtual disk to be used, otherwise the size specified must be greater than or equal to the size of the source disk.

BlockSizeInBytes

Internal size of the virtual disk object blocks, in bytes. This must be set to one of the following values.

ValueMeaning
CREATE_VIRTUAL_DISK_PARAMETERS_DEFAULT_BLOCK_SIZE
0

This is the default value and represents a block size of 2 MB.

524288 (0x80000)

The block size is 512 KB.

2097152 (0x200000)

The block size is 2 MB

 

SectorSizeInBytes

Internal size of the virtual disk object sectors. Must be set to 512.

ValueMeaning
CREATE_VIRTUAL_DISK_PARAMETERS_DEFAULT_SECTOR_SIZE
0x200

The default and only allowable size, 512 bytes.

 

ParentPath

Optional fully qualified path to a parent virtual disk object. Associates the new virtual disk with an existing virtual disk.

If this parameter is not NULL, SourcePath must be NULL.

SourcePath

Optional fully qualified path to pre-populate the new virtual disk object with block data from an existing disk. This path may refer to a virtual disk or a physical disk.

If this parameter is not NULL, ParentPath must be NULL.

Version2

This structure is used if the Version member is CREATE_VIRTUAL_DISK_VERSION_2 (2).

Windows 7 and Windows Server 2008 R2:  This structure is not supported until Windows 8 and Windows Server 2012.
UniqueId

Unique identifier to assign to the virtual disk object. If this member is set to zero, a unique identifier is created by the system.

MaximumSize

The maximum virtual size, in bytes, of the virtual disk object. Must be a multiple of 512.

If a ParentPath is specified, this value must be zero.

If a SourcePath is specified, this value can be zero to specify the size of the source virtual disk to be used, otherwise the size specified must be greater than or equal to the size of the source disk.

BlockSizeInBytes

Internal size of the virtual disk object blocks, in bytes. For VHDX this must be a multiple of 1 MB between 1 and 256 MB. For VHD 1 this must be set to one of the following values.

ValueMeaning
CREATE_VIRTUAL_DISK_PARAMETERS_DEFAULT_BLOCK_SIZE
0

This is the default value and represents a block size of 2 MB. This is the only supported value for fixed VHD 1 virtual disks.

524288 (0x80000)

The block size is 512 KB. This value is not supported on fixed VHD 1 virtual disks.

2097152 (0x200000)

The block size is 2 MB. This value is not supported on fixed VHD 1 virtual disks.

 

SectorSizeInBytes

Internal size of the virtual disk object sectors. For VHDX must be set to 512 (0x200) or 4096 (0x1000). For VHD 1 must be set to 512.

ParentPath

Optional fully qualified path to a parent virtual disk object. Associates the new virtual disk with an existing virtual disk.

If this parameter is not NULL, SourcePath must be NULL.

SourcePath

Optional fully qualified path to pre-populate the new virtual disk object with block data from an existing disk. This path may refer to a virtual disk or a physical disk.

If this parameter is not NULL, ParentPath must be NULL.

OpenFlags

Zero or more flags from the OPEN_VIRTUAL_DISK_FLAG enumeration describing how the virtual disk is to be opened.

ParentVirtualStorageType

A VIRTUAL_STORAGE_TYPE structure describing the parent virtual disk specified in the ParentPath member.

SourceVirtualStorageType

A VIRTUAL_STORAGE_TYPE structure describing the source virtual disk specified in the SourcePath member.

ResiliencyGuid

Resiliency GUID for the file.

Requirements

Minimum supported client

Windows 7

Minimum supported server

Windows Server 2008 R2

Header

VirtDisk.h (include Windows.h)

See also

VHD Structures
About VHD
Naming Files, Paths, and Namespaces
VHD Reference
CreateVirtualDisk

 

 

Build date: 10/26/2012

Community Additions

ADD
Show:
© 2014 Microsoft