preloader
6 June 2012 / #Esxi #Powercli

Memento: NFS maximum

Small memento following an internal question about extending the default maximum number of NFS volumes on ESXi (default is 8).

We found the KB dealing with this issue about modifying ESXi advanced settings (KB2239) :

  • NFS.MaxVolumes: Limits the number of NFS Datastores which can be mounted by the vSphere ESX/ESXi host concurrently. The default value is 8, and can be increased to a maximum specific to the version of ESX/ESXi:
  • ESX/ESXi 3.x: Set NFS.MaxVolumes to 32
  • ESX/ESXi 4.x: Set NFS.MaxVolumes to 64
  • ESXi 5.0; Set NFS.MaxVoumes to 256

Net.TcpipHeapSize: The amount of heap memory, measured in megabytes, which is allocated for managing VMkernel TCP/IP network connectivity. When increasing the number of NFS Datastores, increase the default amount of heap memory as well:

  • ESX/ESXi 3.x: Set Net.TcpipHeapSize to 30
  • ESX/ESXi 4.x: Set Net.TcpipHeapSize to 32
  • ESXi 5.0: Set Net.TcpipHeapSize to 32
  • Net.TcpipHeapMax: The maximum amount of heap memory, measured in megabytes, which can be allocated for managing VMkernel TCP/IP network connectivity. When increasing the number of NFS Datastores, increase the maximum amount of heap memory as well, up to the maximum specific to the version of ESXi/ESX host.
  • ESX/ESXi 3.x : Set Net.TcpipHeapMax to 120
  • ESX/ESXi 4.x: Set Net.TcpipHeapMax to 128
  • ESXi 5.0: Set Net.TcpipHeapMax to 128

Note: These settings enable the maximum number of NFS mounts for vSphere ESX/ESXi.

But (of course) the person wanted to automate this for all his vSphere plateform’s  servers. So we provide a PowerCLI OneLiner in order to do this.

Since the request concerned a platform that was not fully migrated to ESXi 5.0, it was necessary to manage version (since maximum are different between ESXi 4 and 5):

foreach ( $esxhost in Get-VMHost | ?{ $_.PowerState -eq "poweredOn" } ) { if ( ($esxhost.Version -match "^5") -And (((Get-VMHostAdvancedConfiguration -VMHost $esxhost -Name "NFS.MaxVolumes").values -ne 256) -Or ((Get-VMHostAdvancedConfiguration -VMHost $esxhost -Name "Net.TcpipHeapSize").values -ne 32) -Or ((Get-VMHostAdvancedConfiguration -VMHost $esxhost -Name "Net.TcpipHeapMax").values -ne 128))) { Set-VMHostAdvancedConfiguration -VMHost $esxhost -NameValue @{ "NFS.MaxVolumes" = 256; "Net.TcpipHeapSize" = 32; "Net.TcpipHeapMax" = 128 } | Out-Null } elseif ( ($esxhost.Version -match "^4") -And (((Get-VMHostAdvancedConfiguration -VMHost $esxhost -Name "NFS.MaxVolumes").values -ne 64) -Or ((Get-VMHostAdvancedConfiguration -VMHost $esxhost -Name "Net.TcpipHeapSize").values -ne 32) -Or ((Get-VMHostAdvancedConfiguration -VMHost $esxhost -Name "Net.TcpipHeapMax").values -ne 128))) { Set-VMHostAdvancedConfiguration -VMHost $esxhost -NameValue @{ "NFS.MaxVolumes" = 64; "Net.TcpipHeapSize" = 32; "Net.TcpipHeapMax" = 128 } | Out-Null }}

Some settings (Net.TcpipHeapSize and Net.TcpipHeapMax) require reboot in order to be effective:

nfs-max_01

Note : The settings will be modified only if it’s needed, you can run it anytime you want without settings applied each time.


> Frederic MARTIN