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

  1. 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.

     

  2. Invoke the IVdsService::Reenumerate method on the computer that is running the hardware provider.

  3. Initialize the LUN as a basic disk as follows:

    1. Invoke the IUnknown::QueryInterface method on the LUN object to query for the IVdsDisk interface.
    2. Invoke the IVdsSwProvider::CreatePack method to create a basic pack.
    3. Invoke the IVdsPack::AddDisk method to add the disk to the new pack.
  4. Create a partition on the disk and obtain the volume object as follows:

    1. Invoke the IVdsCreatePartitionEx::CreatePartitionEx method to create a partition.
    2. 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.
    3. Pass the volume identifier as a parameter to the IVdsService::GetObject method to get a volume object pointer.
  5. 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.

 

Using VDS

IVdsService::Reenumerate

IVdsDisk

IVdsSwProvider::CreatePack

IVdsPack::AddDisk

IVdsCreatePartitionEx::CreatePartitionEx

IVdsAsync::Wait

VDS_ASYNC_OUTPUT

IVdsVolumeMF::AddAccessPath

IVdsAdvancedDisk::AssignDriveLetter