Adding a Drive Letter to a LUN
[Beginning with Windows 8 and Windows Server 2012, the Virtual Disk Service COM interface is superseded by the Windows Storage Management API.]
You can assign drive letters to volume objects directly; however, if your disk is a LUN object, you have a few additional steps.
To assign a drive letter to a LUN object
If necessary, unmask the LUN to the local host.
Note
You cannot perform software administrative operations on a LUN object that is unmasked to another computer within the current VDS session.
Invoke the IVdsService::Reenumerate method on the computer that is running the hardware provider.
Initialize the LUN as a basic disk as follows:
- Invoke the IUnknown::QueryInterface method on the LUN object to query for the IVdsDisk interface.
- Invoke the IVdsSwProvider::CreatePack method to create a basic pack.
- Invoke the IVdsPack::AddDisk method to add the disk to the new pack.
Create a partition on the disk and obtain the volume object as follows:
- Invoke the IVdsCreatePartitionEx::CreatePartitionEx method to create a partition.
- Invoke the IVdsAsync::Wait method on the async object that is returned by CreatePartitionEx to get the volume identifier from the VDS_ASYNC_OUTPUT structure.
- Pass the volume identifier as a parameter to the IVdsService::GetObject method to get a volume object pointer.
Invoke the IVdsVolumeMF::AddAccessPath method to assign the drive letter.
Note
The IVdsAdvancedDisk::AssignDriveLetter method assigns drive letters to partitions without associated volumes, such as OEM or ESP partitions. You cannot use it to assign a drive letter to a LUN object.
Related topics