Creating a persistent scratch location for ESXi 4.x and 5.x (1033696)



VMware recommends that ESXi has a persistent scratch location available for storing temporary data including logs, diagnostic information, and system swap. (This is not a requirement, however.) Persistent scratch space may be provisioned on a FAT 16, VMFS, or NFS partition accessible by the ESXi host.

Note: Scratch space is configured automatically during installation or first boot of an ESXi host, and does not usually need to be manually configured. ESXi Installable creates a 4 GB Fat16 partition on the target device during installation if there is sufficient space, and if the device is considered Local.

If persistent scratch space is not available, ESXi stores this temporary data on a ramdisk, which is constrained in space. This might be problematic in low-memory situations, but is not critical to the operation of ESXi. Information stored on a ramdisk does not persist across reboots, so troubleshooting information such as logs and core files could be lost. If a persistent scratch location on the host is not configured properly, you may experience intermittent issues due to lack of space for temporary files and the log files will not be updated.


Configuring a persistent scratch location using PowerCLI

To configure persistent scratch space for ESXi using the vSphere PowerCLI interface:


  • Before proceeding, ensure that /tmp/scratch exists. If it does not exist, use the command mkdir /tmp/scratch to create it.
  • For more information on vSphere PowerCLI usage, see the vSphere PowerCLI documentation.
  1. Open a command prompt where the PowerCLI is installed.
  2. Connect to the ESXi host using the command:connect-viserver esx_hostname_or_IP
  3. Obtain a list of datastores reachable from this ESXi host using the command:Get-Datastore
  4. Mount a datastore read/write as a PSDrive using the command:New-PSDrive -Name "mounteddatastore" -Root \ -PSProvider VimDatastore -Datastore (Get-Datastore "DatastoreName")
  5. Access the new PSDrive using the command:Set-Location mounteddatastore:
  6. Create a uniquely-named directory for this ESXi host using the command:New-Item "DirectoryName" -ItemType directory

    For example:

    New-Item ".locker-ESXHostname" -ItemType directory

  7. Check the current value of the ScratchConfig.ConfiguredScratchLocation configuration option using the command:Get-VMHostAdvancedConfiguration -Name "ScratchConfig.ConfiguredScratchLocation"

    NoteVMHostAdvancedConfiguration has been deprecated in PowerCLI 5.1 and replaced with AdvancedSetting. For more information, see the vSphere PowerCLI documentation.

  8. Change the ScratchConfig.ConfiguredScratchLocation configuration option, specifying the full path to the directory created in step 6, using the command:Set-VMHostAdvancedConfiguration -Name "ScratchConfig.ConfiguredScratchLocation" -Value "/vmfs/volumes/DatastoreName/DirectoryName"

    For example:

    Set-VMHostAdvancedConfiguration -Name "ScratchConfig.ConfiguredScratchLocation" -Value "/vmfs/volumes/Datastore1/.locker-ESXHostname"

  9. Put the ESXi host into maintenance mode and reboot for the configuration change to take effect.

Leave a Reply

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