Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I had to implement disk initialization, partitioning, and formatting for one of my company's products. I can't share the code but I can point you in the right direction.</p> <p>The API you want is called VDS - <a href="http://msdn.microsoft.com/en-us/library/bb986750(VS.85).aspx" rel="nofollow noreferrer">Virtual Disk Service</a>. It's a COM API, but I've used it successfully from C++ (with ATL) and C# (COM interop).</p> <p>Sadly the documentation is quite lacking; you just have to immerse yourself in the object model, write some code, and gradually you get a feel for it.</p> <p>Windows Server 2008 ships with an undocumented but quite usable C# wrapper around VDS. Look for a DLL called Microsoft.Storage.Vds.dll. You can use Reflector to discover its various classes and methods. I found out about this when I read <a href="http://blogs.msdn.com/taylorb/archive/2008/09/19/using-the-virtual-disk-service-vds-from-powershell-to-mount-and-use-vhd-s.aspx" rel="nofollow noreferrer">this blog post</a>, in which the author is trying to initialize a disk from PowerShell using the aforementioned DLL. </p> <p>VDS includes APIs that could be implemented by SAN vendors to provision a LUN and do other SAN things; suggest you avoid those and focus on the basic software provider, which will create basic (as opposed to dynamic) partitions on either an MBR or GPT disk. Note that the Microsoft wrapper I mentioned is a bit light on GPT support; I had to modify it a bit to get GPT disks working.</p> <p>VDS is a complex and finicky API, but if you're just looking to initialize a disk, create a partition, format it, and mount it to a drive letter, most of what you need is there and fairly easy to do. Good luck.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload