Thursday, August 1, 2013

SCSI Unmap Tool for ESXi5.0 / ESXi5.1

 Last night I was hit with a question from a client about performing SCSI unmaps on an equallogic array. At first I reviewed Cormac Hogan's excellent blog post on performing this operation here. After reviewing this process I was thinking it would be beneficial to have a GUI for this operation to make it easier for execution. So, last night I went to work on a long coding binge and came up with the first iteration of SCSI unmap tool v1.0 .
 I wouldn't say it was the prettiest interface in the world but it's functional. Designed to run from the top down. Some caveats is this process does create a file based on percentage of free space you would like to reclaim. It will cause added I/O to your array during operation so should be performed during maintenance windows.

NOTE: this feature was removed from esxi5.0 due to unmap duration causing snapshot consolidation and storage vmotion timeouts while it was executing.

Requirements

  1. Powercli 5.1 or greater
  2. One LUN per datastore
  3. Execute during Maintenance window or low I/O times
  4. SSH is enabled on your esxi host performing the unmap operation
  5. v1.0 only supports using one esx host and one datastore per operation
  6. Requires root ssh access.

Tool Overview

For this test I will use a Equallogic Array with one thin provisioned volume. I created some temp vmdks on the volume and added files to the disk through the guest operating system. After completing this step I removed the vmdk from the datastore leaving freespace that is now avaliable in vsphere but showing consumed on my equallogic volumes. See screenshots:

VMFS Volume and EQ Volume before SCSI Unmap




Now I will open the GUI and execute the program to perform unmap operation.

 Below is a screenshot of the same EQ volume after the operation has completed. Due to low load on the EQ array this process took seconds after executing.

For right know the GUI only supports one esx host and one lun per operation. If you would like to do more luns at ones you will need to open multiple copies of the GUI. This was originally target for single lun use.

Download the script here