«

»

ESXi 5.1 VMFS HeapSize configuration using PowerCLI

There are a few of my customer still running vSphere 5.1 U1 and one of them reported an issue related to the VMFS Heap Size (VMFS3.MaxHeapSizeMB) configuration a few days ago. Keep in mind that my customer upgraded to U1 from a previous vSphere 5.1 version meaning that the old VMFS3.MaxHeapSizeMB was retained at 80 MB instead of changed to the vSphere 5.1 U1 value of 640 MB. There is a note about that an upgrade might retain the old value here.

My customer faced several of the issues describe in VMware KB 1004420 when their ESXi hosts addressed more than 8 TB of open VMDKs. See the maximum TB amount of open VMDKs per ESXi in the above mentioned KB.

The blow scripts are tested and verified on the following platform:

  • Windows Server 2008 R2
  • vCenter Server 5.5
  • ESXi 5.5
  • PowerCLI version 5.5
  • PowerShell version 2.0

You can easily verify the ESXi host VMFS3.MaxHeapSizeMB configuration by running the following one-liner.
Change the get-cluster and – value parameters to match your environment and needed configuration.

foreach ($esxi in (get-cluster VCDX56-01 | get-vmhost)) {Get -VMHostAdvancedConfiguration -vmhost $esxi -name VMFS3.MaxHeapSizeMB}

The below command can be used if you are running PowerShell 3.0.

foreach ($esxi in (get-cluster VCDX56-01 | get-vmhost)) {Get -AdvancedSetting -entity $esxi -name VMFS3.MaxHeapSizeMB}

You can use the following one-liner to change the VMFS3.MaxHeapSizeMB for the ESXi hosts to the value you prefer.

foreach ($esxi in (get-cluster VCDX56-01 | get-vmhost)) {Set -VMHostAdvancedConfiguration -vmhost $esxi -name VMFS3.MaxHeapSizeMB -value 640}

The below command can be used if you are running PowerShell 3.0.

foreach ($esxi in (get-cluster VCDX56-01 | get-vmhost)) {get -AdvancedSetting -entity $esxi -name VMFS3.MaxHeapSizeMB | Set-AdvancedSetting - Value 640 -confirm:$false}

Keep in mind that the above one-liner will set the VMFS3.MaxHeapSizeMB to 640 configuration even if it is already set to 640.

But for those of you who know me i must also provide a script that will only change the value if needed and also send a email report of what has been done:)
Below you’ll find the PowerCLI script i used in my customers environment.

Change the following parameters in the below script to match your environment:

  • $vcenter = “vc-demo01“
  • $vcenteruser = “vcdx56\magnus“
  • $vcenterpw = “not secret“
  • $cluster = “VCDX56-01”
  • $sendTo = “magnus@vcdx56.com“
  • $sendFrom = “vc-demo01@vcdx56.com“
  • $smtpserver = “smtp.vcdx56.local“
  • $VHSMB = “640”
# ESXi Host VMFS Heap size configuration
# Version 1.0 Magnus Andersson
#————————————————
# Start of script parameters section
#
# Specify vCenter Server and its credentials
$vcenter = “vc-demo01“
$vcenteruser = "vcdx56\magnus“
$vcenterpw = “notsecret“
#
# Specify vSphere cluster
$cluster = "VCDX56-01"
#
$sendTo = “magnus@vcdx56.com“
$sendFrom = “vc-demo01@vcdx56.com“
$smtpserver = “smtp.vcdx56.local“
#
# Specify the new VMFS3.MaxHeapSizeMB configuration
$VHSMB = "640"
#
# End of script parameter section
#——————————————
#
# Connect to vcenter Server
connect-viserver $vcenter -User $vcenteruser -Password $vcenterpw
#
# Verify if configuration changes are needed and if so, change the configuration to the value 1
$Body = @()
get-cluster $cluster | Get-VMHost | sort | Foreach {
if (($_ | Get-VMHostAdvancedConfiguration -name VMFS3.MaxHeapSizeMB)["VMFS3.MaxHeapSizeMB"] -ne 640) {
$Body = $Body + “VMFS3.MaxHeapSizeMB value for $($_) is not 640 and will be changed. New Configuration for $_ is” | out-string
$newBody = (set-VMHostAdvancedConfiguration -vmhost $_ -name VMFS3.MaxHeapSizeMB -value $VHSMB)
$Body += $newBody | out-string
} else {
$Body = $Body + “VMFS3.MaxHeapSizeMB value for $($_) is correct and does not need to be changed” | out-string
}
}
#
# Send e-mail report
send-mailmessage -to $sendTo -from $sendFrom -Subject “ESXi host VMFS3.MaxHeapSizeMB configuration report” -smtpserver $smtpserver -Body $Body

Here is the email report you’ll receive when running the script:
Screen Shot 2014-01-04 at 00.32.30

3 pings

Comments have been disabled.