IVdsPack::AddDisk 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.]
Adds a disk to an online pack.
Syntax
HRESULT AddDisk(
[in] VDS_OBJECT_ID DiskId,
[in] VDS_PARTITION_STYLE PartitionStyle,
[in] BOOL bAsHotSpare
);
Parameters
[in] DiskId
The GUID of the disk.
[in] PartitionStyle
The style can be MBR or GPT. See the VDS_PARTITION_STYLE enumeration.
[in] bAsHotSpare
If true, VDS can use the disk as a hot spare; otherwise, the disk cannot be used for this operation. Only hardware providers support hot sparing.
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 disk was added successfully. |
|
The disk is raw. |
|
The disk to be added is being cleaned. |
|
There is a provider failure during the operation. |
|
Adding a second disk to a basic pack is not supported. |
|
The target pack is inaccessible. |
|
The disk is not found. |
|
The logical disk manager (LDM) service failed to complete a method. |
|
The dynamic provider cache is corrupt. |
Remarks
VDS implements this method.
This method initializes a raw disk (a disk that has no partitioning defined) and adds it to the pack. Before this method is called, the raw disk is owned by the VDS service. After this method returns, the disk is owned by the basic provider.
To undo the effect of this method—that is, to remove the partitioning format and cause the disk to be a raw disk that is owned by the VDS service—use the IVdsAdvancedDisk::Clean method.
You cannot use AddDisk to redefine the partitioning on an existing disk.
If you add a GPT disk to a basic pack, the operation automatically creates a MSR partition on the disk. Devices running the WinPE operating system are the exception because an administrator might prefer to create an ESP partition on the disk. The ESP partition, if present, must be the first partition on the disk.
If you add the disk to a dynamic pack, the operation does not create a MSR partition.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows Vista [desktop apps only] |
Minimum supported server | Windows Server 2003 [desktop apps only] |
Target Platform | Windows |
Header | vds.h |
Library | Uuid.lib |