Category Archives: XtremIO

New Powershell REST API Module for XtremIO

An EMC SE has recently published to Github a powershell module for making REST API calls to XtremIO arrays. The module greatly simplifies leveraging these API’s.

Manually this task includes setting the username and password, converting them to the proper format, setting the headers and than finally making the REST API calls.

An example of this look like the below code. A few pieces are left out from this example but this is the basics.

$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($pass)
$password = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)
$EncodedAuthorization = [System.Text.Encoding]::UTF8.GetBytes($username + ':' + $password)
$EncodedPassword = [System.Convert]::ToBase64String($EncodedAuthorization)
$headers = @{"Authorization"="Basic $($EncodedPassword)"}

$baseUri = "https://" + $ip.IPAddressToString + ":443/api/json/types" 
$xCluster = (Invoke-WebRequest -Uri $baseURI/clusters/1 -Headers $headers).content

With this new powershell module, this gets simplified to be straightforward one-line commands from powershell


Make sure to take careful note of the task to import the certificates from the XMS for each array you want to query. If this step isn’t completed correctly, you will receive errors back from powershell that may leave you scratching your head.

It is also requires a minimum of powershell v4

Check out the Git page for more examples and to download the module at the link below


XtremIO VAAI Reclaiming Deleted Storage

Reclaiming deleted storage on luns is a straight fotward task.  XtremIO fully supports UNMAP

In vSphere 5.1:

SSH into ESXi

cd /vmfs/volumes/<volume_name>

vmkfstools -y <percentage_to_reclaim>

Example:    vmkfstools -y 99

In vSphere 5.5:

Couple of notes about running this in vSphere 5.5.  If -n is not specified, the default number of blocks to UNMAP is 200 per iteration.   Unlike in vSphere 5.1, the UNMAP can be run from any directory.  You do not need to be in the volume directory to perform this task.

SSH into ESXi

esxcli storage vmfs unmap -l <volume_name> -n <blocks>


esxcli storage vmfs unmap -u <volume_UUID> -n <blocks>

Example:    esxcli storage vmfs unmap -l <volume_name> -n 20000


Additional Reference Material:

VMware KB2014849 (vSphere 5.1)

VMware KB2057513 (vSphere 5.5)