Adding a Drive Letter to a LUN
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.
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:
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.
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.