<div dir="ltr" style="text-align: left;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;"><span itemprop="articleBody">If you use thin provisioned VMFS datastores you will maybe face the problem that unused space on the storage is not released automatically when you delete or migrate a virtual machine.vSphere 5.0 introduced the VAAI Thin Provisioning Block Space Reclamation (UNMAP) Primitive. This feature was designed to efficiently reclaim deleted space to meet continuing storage needs. ESXi 5.x issues UNMAP commands for space reclamation during several operations. ;</span></span></span></p>
<p>Connect to VM host using SSH</p>
<p><b><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;"><span itemprop="articleBody">Step 1: ;</span></span></span></b><br /><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;"><span itemprop="articleBody">First get the naa ID from the affected LUN. You can do this by using the command: </span></span></span><br /><span style="color: red;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;"><i># esxcli storage vmfs extent list</i></span></span></span></p>
<p><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;"><span itemprop="articleBody"><b>Step 2: ; </b></span></span></span><br /><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;"><span itemprop="articleBody"><span itemprop="articleBody">To confirm if SCSI UNMAP is supported on a LUN, open an SSH session to a host and run this command:<br /><i><span style="color: red;"><code># esxcli storage core device vaai status get -d naa.xxxxxxxx</code></span></i></span></span></span></span></p>
<p><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;"><span itemprop="articleBody"><span itemprop="articleBody"></span></span></span></span><br /><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;"><span itemprop="articleBody"><span itemprop="articleBody"><br /></span><b>Step 3:</b></span></span></span><br /><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;"><span itemprop="articleBody"> ;if deleted status supported run following command to reclaim free space</span></span></span><br /><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;"><span itemprop="articleBody">Example:</span></span></span><br /><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;">If you want to release 60 percent of the free memory extend the command with 60:</span></span><br /><span style="color: red;"><i><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;">vmkfstools -y 60</span></span></i></span></p>
<p><b><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;">Few Useful Commands:</span></span></b></p>
<p><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;">Lun Information:on storage array <b><br /></b></span></span><br /><i><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;"><span style="color: red;">lun show -v /vol/vol2/thin-lun</span></span></span></i></p>
<p><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;">Detailed volume information:</span></span><br /><i><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;"><span style="color: red;">vmkfstools -Ph -v 1 /vmfs/volumes/source-datastore/</span></span></span></i></p>
<p><span itemprop="articleBody"><b>The <code>vmkfstools -y</code> command is deprecated in ESXi 5.5. </b></span>To reclaim unused storage blocks on a VMFS datastore for a thin-provisioned device, run the command:<span style="color: red;"><code> ;</code></span></p>
<p><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;"><span style="color: red;"><code>esxcli storage vmfs unmap --volume-label=<i>volume_label</i>|--volume-uuid=<i>volume_uuid</i> --reclaim-unit=<i>number</i></code></span></span></span></p>
<p><b>For example</b>, for a VMFS volume named <code>MyDatastore</code> with UUID of <code>509a9f1f-4ffb6678-f1db-001ec9ab780e</code>, run the command:<code> ;</code></p>
<p><span style="color: red;"><code>esxcli storage vmfs unmap -l MyDatastore</code><code> </code></span><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;"><span style="color: red;"><code>--reclaim-unit=<i>200</i></code></span></span></span><br /><span style="color: red;"><code><span style="color: black;"><b>or </b></span></code></span><br /><span style="color: red;"><code>esxcli storage vmfs unmap -u 509a9f1f-4ffb6678-f1db-001ec9ab780e -n 200</code></span></p>
<p><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;"><i>Notes:</i></span></span></p>
<ul style="text-align: left;">
<li><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;"><i>It should be noted that this process can lead to high latency on the affected LUNs. So this work should better be done during a maintenance window.</i> ;</span></span></li>
<li><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;">Calculate reclamation size based upon datastore free space; you cannot reclaim more space than the datastore is able to provide.</span></span></li>
<li><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;">This command creates temporary hidden files at the top level of the datastore with names using the <code>.vmfsBalloon*</code> pattern (for example, <code>.vmfsBalloonGdwBBv</code>). These files can be as large as the aggregate size of blocks being reclaimed. If the reclaim operation or storage access is interrupted, these temporary files might not be automatically deleted and you must delete them manually to create free space on the datastore.</span></span></li>
</ul>
</div>

