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.
[in] lNumberOfDisks
Number of elements in the array pointed to by the pInputDiskArray parameter.
[in] ulStripeSize
Stripe size, in bytes, of the new volume.
[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 |
---|---|
|
The volume was created successfully. |
|
No volume arrival notification was received. You may need to call IVdsService::Refresh. |
|
The volume is created successfully, but VDS failed to update the boot options in the Boot Configuration Data (BCD) store. |
|
The specified alignment is zero. |
|
The specified alignment is not a power of two. |
|
The specified disks do not belong to the same pack. |
|
The LDM service failed a method. |
|
The extent size passed in is too small. |
|
The number of disks specified is not valid for this operation. |
|
The member count for the volume must be greater than zero. |
|
The member indexes must be monotonically increasing and begin with zero. |
|
The disk passed in is a CD-ROM or DVD device. |
|
This operation is not allowed on this disk pack. |
|
The plex count for the volume must be greater than zero. |
|
The plex indexes must be monotonically increasing and begin with zero. |
|
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. |
|
The specified disk is missing. |
|
There is no media in a removable drive passed in through the disk array. |
|
There is not enough space on one of the disks. |
|
The volume type is not supported. |
|
At least one of the disks passed in is not found. |
|
A single disk cannot contribute to multiple members or multiple plexes of the same volume. |
|
The target pack is inaccessible. |
|
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. |
|
The dynamic provider cache is corrupt. |
|
No more than 32 disks are allowed per volume. |
|
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 |