<div class="content" name="InitializeDisk" uuid="e36e1922-9ec7-4010-a49b-0f074bd002d3"><p> </p><p>The InitializeDisk method converts an uninitialized <span><a href="3c91641b-e5cd-409e-a445-2e4d61ae33c6#gt_c4133b2a-a990-4042-ba44-7fda3090f118" data-linktype="relative-path">disk</a></span>
into a dynamic disk. This is a synchronous task.</p><dl>
<dd>
<div><pre> HRESULT InitializeDisk(
   [in] LdmObjectId diskId,
   [in] hyper diskLastKnownState,
   [out] TASK_INFO* tinfo
 );
</pre></div>
</dd></dl><p><b>diskId: </b>Specifies the OID of the disk to
initialize.</p><p><b>diskLastKnownState: </b>Disk&#39;s last known <span><a href="3c91641b-e5cd-409e-a445-2e4d61ae33c6#gt_5a574d80-6bdb-4fb0-a0dd-b0601d16b4cd" data-linktype="relative-path">modification
sequence number</a></span>.</p><p><b>tinfo: </b>Pointer to a <span><a href="d55c167e-c6ad-445f-951c-9ac2d0de7a11" data-linktype="relative-path">TASK_INFO</a></span> structure
that the client can use to track the request&#39;s progress.</p><p><b>Return Values: </b>The method MUST return 0 or a
nonerror <a href="../ms-dtyp/a9046ed2-bfb2-4d56-a719-2824afce59ac" data-linktype="relative-path"><span>HRESULT</span></a> on success, or
an implementation-specific nonzero error code on failure (as specified in <span><a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a></span>;
see also section <span><a href="31eea9e6-25b0-4309-8f4a-50c74fbedc9b" data-linktype="relative-path">2.2.1</a></span> for HRESULT
values predefined by the Disk Management Remote Protocol).</p><p>Upon receiving this message, the server MUST validate
parameters:</p><ol><li><p><span>    </span>Verify that the
disk specified by <i>diskId</i> is in the list of storage objects and check
whether <i>diskLastKnownState</i> matches the <b>LastKnownState</b> field of
the object.</p>
</li><li><p><span>    </span>Verify that <i>tinfo</i>
is not NULL.</p>
</li></ol><p>If parameter validation fails, the server MUST fail the
operation immediately, returning an appropriate error as its response to the
client.</p><p>Otherwise, the server MUST process the message as follows:</p><ol><li><p><span>    </span>Initialize the
disk specified by <i>diskId</i> with an empty <span><a href="3c91641b-e5cd-409e-a445-2e4d61ae33c6#gt_b251c771-5ccf-40f2-b98d-0119db210b4b" data-linktype="relative-path">MBR</a></span> <span><a href="3c91641b-e5cd-409e-a445-2e4d61ae33c6#gt_cee39671-0b98-4ca3-904d-018780e7042f" data-linktype="relative-path">partition
table</a></span> and write an MBR signature to it.</p>
</li><li><p><span>    </span>If successful,
convert the disk to a dynamic disk. </p>
</li><li><p><span>    </span>Wait for the
conversion to either succeed or fail.</p>
</li><li><p><span>    </span>Fill in the <i>tinfo</i>
output parameter. </p>
<table><thead>
  <tr>
   <th>
   <p>TASK_INFO member</p>
   </th>
   <th>
   <p>Required for this operation</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>TASK_INFO::id</p>
  </td>
  <td>
  <p>Required.</p>
  </td>
 </tr><tr>
  <td>
  <p>TASK_INFO::storageId</p>
  </td>
  <td>
  <p>Not required.</p>
  </td>
 </tr><tr>
  <td>
  <p>TASK_INFO::createTime</p>
  </td>
  <td>
  <p>Not required.<a id="Appendix_A_Target_128"></a><a aria-label="Product behavior note 128" href="5f5043a3-9e6d-40cc-a05b-1a4a3617df32#Appendix_A_128" data-linktype="relative-path">&lt;128&gt;</a></p>
  </td>
 </tr><tr>
  <td>
  <p>TASK_INFO::clientID</p>
  </td>
  <td>
  <p>Not required.<a id="Appendix_A_Target_129"></a><a aria-label="Product behavior note 129" href="5f5043a3-9e6d-40cc-a05b-1a4a3617df32#Appendix_A_129" data-linktype="relative-path">&lt;129&gt;</a></p>
  </td>
 </tr><tr>
  <td>
  <p>TASK_INFO::percentComplete</p>
  </td>
  <td>
  <p>Required for any task that returns REQ_IN_PROGRESS.</p>
  </td>
 </tr><tr>
  <td>
  <p>TASK_INFO::status</p>
  </td>
  <td>
  <p>Required.</p>
  </td>
 </tr><tr>
  <td>
  <p>TASK_INFO::type</p>
  </td>
  <td>
  <p>Required if PercentageComplete is being used.</p>
  </td>
 </tr><tr>
  <td>
  <p>TASK_INFO::error</p>
  </td>
  <td>
  <p>Required.</p>
  </td>
 </tr><tr>
  <td>
  <p>TASK_INFO::tflag</p>
  </td>
  <td>
  <p>Not required.<a id="Appendix_A_Target_130"></a><a aria-label="Product behavior note 130" href="5f5043a3-9e6d-40cc-a05b-1a4a3617df32#Appendix_A_130" data-linktype="relative-path">&lt;130&gt;</a></p>
  </td>
 </tr></tbody></table>
</li><li><p><span>    </span>Return a
response to the client containing <i>tinfo</i> and the status of the operation.
</p>
</li><li><p><span>    </span>Send the task
completion notification. </p>
</li></ol><p>If the operation is successful, the server MUST make the
following changes to the list of storage objects before returning the response:</p><ol><li><p><span>    </span>Modify the disk
object to account for the change in type.</p>
</li><li><p><span>    </span>Delete <span><a href="3c91641b-e5cd-409e-a445-2e4d61ae33c6#gt_753cb2b4-3f5c-48f3-97ef-61612c40499e" data-linktype="relative-path">disk
region</a></span> objects residing on the uninitialized disk.<a id="Appendix_A_Target_131"></a><a aria-label="Product behavior note 131" href="5f5043a3-9e6d-40cc-a05b-1a4a3617df32#Appendix_A_131" data-linktype="relative-path">&lt;131&gt;</a></p>
</li><li><p><span>    </span>Create disk
region objects residing on the dynamic disk. </p>
</li></ol></div>