IVdsPack2::CreateVolume2 method (vds.h)

[Beginning with Windows 8 and Windows Server 2012, the Virtual Disk Service COM interface is superseded by the Windows Storage Management API.]

Creates a volume in a disk pack with an optional alignment parameter.

Syntax

HRESULT CreateVolume2(
  [in]  VDS_VOLUME_TYPE type,
  [in]  VDS_INPUT_DISK  *pInputDiskArray,
  [in]  LONG            lNumberOfDisks,
  [in]  ULONG           ulStripeSize,
  [in]  ULONG           ulAlign,
  [out] IVdsAsync       **ppAsync
);

Parameters

[in] type

Value from the VDS_VOLUME_TYPE enumeration that indicates the type of volume to create.

[in] pInputDiskArray

Array of VDS_INPUT_DISK structures that indicate the disks on which to create the volume.

Note  This array's size must be 32 objects or less, because Windows imposes a limit where no more than 32 disks may be used with a single volume.
 

[in] lNumberOfDisks

Number of elements in the array pointed to by the pInputDiskArray parameter.

[in] ulStripeSize

Stripe size, in bytes, of the new volume.

Note  The stripe size must be 65536 if the type is VDS_VT_STRIPE or VDS_VT_PARITY; otherwise, the stripe size MUST be 0.
 

[in] ulAlign

Number of bytes for volume alignment. This parameter is optional and can be zero. If zero is specified, the server will determine the alignment value depending on the size of the disk on which the volume is created.

Windows 7, Windows Server 2008 R2, Windows Vista and Windows Server 2008:  On a basic disk, the CreateVolume2 method ignores this parameter and the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\vds\Alignment registry key. This is a known issue and is being addressed. As a workaround, use the IVdsAdvancedDisk::CreatePartition or IVdsCreatePartitionEx::CreatePartitionEx method to create partitions on the basic disk so that they are aligned correctly.Dynamic partitions and volumes are aligned using the values under the following registry key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\vds\Alignment

The default alignment is 1 MB if the disk is 4 GB or larger, or 64 KB if the disk is smaller than 4 GB.

[out] ppAsync

Pointer to an IVdsAsync interface that upon successful completion receives the IVdsAsync interface to monitor and control this operation. Callers must release the interface received when they are done with it. If the IVdsAsync::Wait method is called on the interface and a success HRESULT value is returned, the interfaces returned in the VDS_ASYNC_OUTPUT structure must be released by calling the IUnknown::Release method on each interface pointer. However, if Wait returns a failure HRESULT value, or if the pHrResult parameter of Wait receives a failure HRESULT value, the interface pointers in the VDS_ASYNC_OUTPUT structure are NULL and do not need to be released. You can test for success or failure HRESULT values by using the SUCCEEDED and FAILED macros defined in Winerror.h.

Return value

This method can return standard HRESULT values, such as E_INVALIDARG or E_OUTOFMEMORY, and VDS-specific return values. It can also return converted system error codes using the HRESULT_FROM_WIN32 macro. Errors can originate from VDS itself or from the underlying VDS provider that is being used. Possible return values include the following.

Return code/value Description
S_OK
The volume was created successfully.
VDS_S_NO_NOTIFICATION
0x00042517L
No volume arrival notification was received. You may need to call IVdsService::Refresh.
VDS_S_UPDATE_BOOTFILE_FAILED
0x00042434L
The volume is created successfully, but VDS failed to update the boot options in the Boot Configuration Data (BCD) store.
VDS_E_ALIGN_IS_ZERO
0x80042590L
The specified alignment is zero.
VDS_E_ALIGN_NOT_A_POWER_OF_TWO
0x8004258FL
The specified alignment is not a power of two.
VDS_E_DISK_NOT_FOUND_IN_PACK
0x8004252DL
The specified disks do not belong to the same pack.
VDS_E_DMADMIN_METHOD_CALL_FAILED
0x80042420L
The LDM service failed a method.
VDS_E_EXTENT_SIZE_LESS_THAN_MIN
0x80042433L
The extent size passed in is too small.
VDS_E_INVALID_DISK_COUNT
0x80042526L
The number of disks specified is not valid for this operation.
VDS_E_INVALID_MEMBER_COUNT
0x80042522L
The member count for the volume must be greater than zero.
VDS_E_INVALID_MEMBER_ORDER
0x80042524L
The member indexes must be monotonically increasing and begin with zero.
VDS_E_INVALID_OPERATION
0x80042415L
The disk passed in is a CD-ROM or DVD device.
VDS_E_INVALID_PACK
0x8004251AL
This operation is not allowed on this disk pack.
VDS_E_INVALID_PLEX_COUNT
0x80042521L
The plex count for the volume must be greater than zero.
VDS_E_INVALID_PLEX_ORDER
0x80042523L
The plex indexes must be monotonically increasing and begin with zero.
VDS_E_INVALID_STRIPE_SIZE
0x80042525L
The stripe size in bytes must be a power of 2 for striped and RAID-5 volume types and must be zero for all other volume types.
VDS_E_MISSING_DISK
0x80042454L
The specified disk is missing.
VDS_E_NO_MEDIA
0x80042412L
There is no media in a removable drive passed in through the disk array.
VDS_E_NOT_ENOUGH_SPACE
0x8004240FL
There is not enough space on one of the disks.
VDS_E_NOT_SUPPORTED
0x80042400L
The volume type is not supported.
VDS_E_OBJECT_NOT_FOUND
0x80042405L
At least one of the disks passed in is not found.
VDS_E_ONE_EXTENT_PER_DISK
0x80042531L
A single disk cannot contribute to multiple members or multiple plexes of the same volume.
VDS_E_PACK_OFFLINE
0x80042444L
The target pack is inaccessible.
VDS_E_PARTITION_LIMIT_REACHED
0x80042407L
The maximum number of partitions (primary partitions or primary partitions with an extended partition) already exists when the caller tries to create an additional primary partition or extended partition.
VDS_E_PROVIDER_CACHE_CORRUPT
0x8004241FL
The dynamic provider cache is corrupt.
VDS_E_VOLUME_DISK_COUNT_MAX_EXCEEDED
0x80042529L
No more than 32 disks are allowed per volume.
VDS_E_VOLUME_TOO_SMALL
0x8004242CL
The volume size is too small.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header vds.h
Library Uuid.lib

See also

IVdsPack2

IVdsPack::CreateVolume