Use PowerCLI to mark disk as as SSD

I’ve recently been working with a few new ESXi hosts. These systems have a pair of solid state disks that I planned to use for host cache. However, ESXi 5.0 did not detect these disks as an SSD type. I found a couple articles describing how to trick ESXi into thinking a data store was SSD:

Yellow-Bricks: Swap to host cache aka swap to SSD
VirtuallyGhetto: How to Trick ESXi 5 in seeing an SSD Datastore

After confirming with my third party vendors that this was a supported configuration, I tested and confirmed that using the enable_ssd option would resolve my issues. Since my host build script is written in PowerCLI, I wanted to re-write the vMA commands using Get-EsxCli.

[cc lang=”powershell”]
$localDisk = Get-ScsiLun | where {$_.ExtensionData.DisplayName -match “Local LSI Disk”}
$canName = $localDisk.CanonicalName
$esxcli = Get-EsxCli
$satp = ($ | where {$_.Device -eq $canName }).StorageArrayType

The local VMFS data store needs to be created first. I encountered some errors when running the commands against an unformatted/RAW device.

This entry was posted in Scripting, Virtualization. Bookmark the permalink.

2 Responses to Use PowerCLI to mark disk as as SSD

  1. Pingback: VCDA510 – Objective 1.1 – Implement and Manage Complex Storage Solutions – Skills And Abilities | VCDX or Bust

  2. Just wanted to say thanks for this script! This is exactly what we needed to do trying to configure VSAN on our hosts and it didn’t detect our SSDs. We modified the script a little bit and I’ve posted it below. We search for all drives around a certain size, in our case the drive was reporting a size of 185.333GB. We then loop through each drive and change all of them. I thought I would share if this would be helpful at all. Thanks again!

    $server = “”
    Connect-VIServer -Server $server -user root -password Yourpassword
    $esxcli = Get-EsxCli -VMHost $server
    $localDisk = Get-ScsiLun | where {$_.CapacityGB -lt 200 -and $_.CapacityGB -gt 180}|foreach {$canName = $_.CanonicalName;$satp = ($ | where {$_.Device -eq $canName }).StorageArrayType;$$null,$null,$null,$canname,$null,$null,$null,”enable_ssd”,$null,$null,$satp,$null,$null,$null);$$canName)}
    $|select Device, Size, IsSSD
    Disconnect-VIServer -confirm:$false

Leave a Reply

Your email address will not be published. Required fields are marked *


Notify me of followup comments via e-mail. You can also subscribe without commenting.