Knowledge Base

|
Creating a persistent scratch location for ESXi 4.x and 5.x (1033696)
Symptoms
- When you run the command
esxcli software vib list, you see an error similar to:Traceback (most recent call last):File "/usr/lib/vmware/esxcli-software", line 432, in <module>setupLogging()File "/usr/lib/vmware/esxcli-software", line 78, in setupLogginghandler = logging.handlers.SysLogHandler(address='/dev/log')File "/build/mts/release/bora-504890/bora/build/esx/release/python-2.6-lib-zip-stage/504890/visor/pylib/python2.6/logging/handlers.py",line 704, in __init__File "/build/mts/release/bora-504890/bora/build/esx/release/python-2.6-lib-zip-stage/504890/visor/pylib/python2.6/logging/handlers.py",line 719, in _connect_unixsocketFile "<string>", line 1, in connectsocket.error: [Errno 2] No such file or directory
- None of the commands related to
esxcli softwareoresxupdatework. - Scanning the host using Update Manager fails with the error:
General System Error
- Rebooting the host initially resolves the issue, but it reoccurs in a few days.
- Log files are missing in
/var/log/or are not being updated. - You cannot install HA agent on affected ESXi hosts.
- ESXi is installed on a SD card or USB stick.
Purpose
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.
Starting with VirtualCenter 2.5 Update 1, only ESXi systems with swap enabled can be added to an HA cluster. For more information, see ESXi hosts without swap enabled cannot be added to a VMware High Availability Cluster (1004177).
Cause
Scratch space is configured automatically during installation or first boot of an ESXi 4.1 U2 and later host, and does not usually need to be manually configured. For more details, see the Additional Information section of this article.
Resolution
Scratch space can be manually configured for an ESXi host using the vSphere Client, the vCLI, PowerCLI, Tech Support Mode, or during scripted installation. Select the method appropriate to your environment. Regardless of the method selected, the configuration is written to the /etc/vmware/locker.conf configuration file for use during the next boot.
Changing the configured scratch location requires a reboot of the ESXi host for the changes to take effect. VMotion or power off all virtual machines on the ESXi host prior to making the change. For more information, see Rebooting an ESX Server host (1003530).
The configured scratch location must point to a directory on a filesystem accessible to the ESXi host, such as a Fat16 or VMFS volume. The location may be a directory on a shared or remote disk as long as the ESXi host is allocated its own separate directory.
Configuring a persistent scratch location using the vSphere Client
You can configure persistent scratch space for ESXi using the vSphere Client:
- Connect to vCenter Server or the ESXi host using the vSphere Client.
- Select the ESXi host in the inventory.
- Click the Configuration tab.
- Click Storage.
- Right-click a datastore and select Browse.
- Create a uniquely-named directory for this ESX host (for example,
.locker-ESXHostname) - Close the Datastore Browser.
- Click Advanced Settings under Software.
- Select the ScratchConfig section.
- Change the ScratchConfig.ConfiguredScratchLocation configuration option, specifying the full path to the directory.
For example:
/vmfs/volumes/DatastoreName/.locker-ESXHostname
- Click OK.
- Put the ESXi host in maintenance mode and reboot for the configuration change to take effect.
Configuring a persistent scratch location using the vCLI
You can configure persistent scratch space for ESXi using the vSphere Command-Line Interface. For more information on usage, see the vSphere Command-Line Interface Documentation.
- Open a command prompt at the location where the vCLI is installed.
- Obtain a list of datastores reachable from this ESXi host using the command:
vifs.pl connectoptions --listds
For example:vifs.pl --server esxhostnameorip --username root --listds
- Create a uniquely-named directory for this ESXi host using the command:
vifs.pl connectoptions --mkdir "[DatastoreName] DirectoryName"
For example:vifs.pl --server esxhostnameorip --username root --mkdir "[Datastore1] .locker-ESXHostname"
- Check the current value of the
ScratchConfig.ConfiguredScratchLocationconfiguration option using the command:vicfg-advcfg.pl connectoptions -g ScratchConfig.ConfiguredScratchLocation
For example:
vicfg-advcfg.pl --server esxhostnameorip --username root -g ScratchConfig.ConfiguredScratchLocation
Value of ScratchConfig.ConfiguredScratchLocation is /path/to/location
- Change the
ScratchConfig.ConfiguredScratchLocationconfiguration option, specifying the full path to the directory created in Step 3, using the command:vicfg-advcfg.pl connectoptions -s /vmfs/volumes/DatastoreName/DirectoryNameScratchConfig.ConfiguredScratchLocation
For example:vicfg-advcfg.pl --server esxhostnameorip --username root -s /vmfs/volumes/Datastore1/.locker-ESXHostname ScratchConfig.ConfiguredScratchLocation
- Put the ESXi host into maintenance mode and reboot for the configuration change to take effect.
Configuring a persistent scratch location using PowerCLI
- Open a command prompt where the PowerCLI is installed.
- Connect to the ESXi host using the command:
connect-viserver ESXHostnameOrIP
- Obtain a list of datastores reachable from this ESXi host using the command:
Get-Datastore
- Mount a datastore read/write as a PSDrive using the command:
New-PSDrive -Name "mounteddatastore" -Root \ -PSProvider VimDatastore -Datastore (Get-Datastore "DatastoreName")
- Access the new PSDrive using the command:
Set-Location mounteddatastore:
- 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
- Check the current value of the
ScratchConfig.ConfiguredScratchLocationconfiguration option using the command:Get-VMHostAdvancedConfiguration -Name "ScratchConfig.ConfiguredScratchLocation"
Note:VMHostAdvancedConfiguration has been deprecated in PowerCLI 5.1and replaced with AdvancedSetting. For more information, see the vSphere PowerCLI documentation.
- Change the
ScratchConfig.ConfiguredScratchLocationconfiguration 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" - Put the ESXi host into maintenance mode and reboot for the configuration change to take effect.
Configuring a persistent scratch location using Tech Support Mode
You can configure persistent scratch space for ESXi using Tech Support Mode on ESXi, either via the local console or SSH.
Note: A .filename is a hidden file. To view hidden files, use the ls -a command.
- Open a console to the ESXi host. For more information, see Using Tech Support Mode in ESXi 4.1 and 5.0 (1017910).
- Obtain a list of datastores reachable from this ESXi host using the command:
ls /vmfs/volumes
- Create a uniquely-named directory for this ESXi host using the command:
mkdir /vmfs/volumes/DatastoreName/DirectoryName
For example:mkdir /vmfs/volumes/Datastore1/.locker-ESXHostname
- Check the current value of the
ScratchConfig.ConfiguredScratchLocationconfiguration option using the command:vim-cmd hostsvc/advopt/view ScratchConfig.ConfiguredScratchLocation
Example output:(vim.option.OptionValue) [
(vim.option.OptionValue) {
dynamicType = <unset>,
key = "ScratchConfig.ConfiguredScratchLocation",
value = "/path/to/location",
}
}
- Change the
ScratchConfig.ConfiguredScratchLocationconfiguration option, specifying the full path to the directory created in Step 3, using the command:vim-cmd hostsvc/advopt/update ScratchConfig.ConfiguredScratchLocation string /vmfs/volumes/DatastoreName/DirectoryName
For example:/bin/vim-cmd hostsvc/advopt/update ScratchConfig.ConfiguredScratchLocation string /vmfs/volumes/Datastore1/.locker-ESXHostname
- Put the ESXi host into maintenance mode and reboot for the configuration change to take effect.
Configuring a persistent scratch location during scripted install using kickstart scripts
You can configure persistent scratch space for ESXi during kickstart installation by adding commands to your kickstart scripts which create the directory and change the configuration option. For more information on ESXi scripted deployments, see the ESXi Installable and vCenter Server Setup Guide.
Append these commands to your custom kickstart script:
# Generate a new scratch directory for this host on a Datastorescratchdirectory=/vmfs/volumes/DatastoreName/.locker-$(hostname 2> /dev/null)-$(esxcfg-info -b 2> /dev/null)
# Create the scratch directory
mkdir -p $scratchdirectory
# Change the advanced configuration option
vim-cmd hostsvc/advopt/update ScratchConfig.ConfiguredScratchLocation string $scratchdirectory
Configuring a persistent scratch location using vSphere Web Client for ESXi 5.1
- Log in to the vCenter Server using the vSphere Web Client
- Click on Hosts and Clusters and then select the specific host
- Click the Manage tab
- Click Settings
- Under System, select Advanced System Settings
- Locate ScratchConfig.ConfiguredScratchLocation
- Select Edit button and add the path to the Scratch directory
- Reboot the host for the changes to take effect.
Additional Information
- The Configuring Storage Behavior section of the ESXi Setup Guide for your version of ESXi
- About the Scratch Partition
- Place the host into Maintenance Mode and reboot the host.
- Click the Configuration tab.
- Click Software.
- Click Advanced Settings.
- Select the ScratchConfig section.
- Change the ScratchConfig.ConfiguredScratchLocation configuration option and set it to the full path of the directory.
For example:
/vmfs/volumes/DatastoreName/.locker-ESXHostname
- Click OK.
- Close the window.
- Click Advanced Settings to reopen the window.
- Select the ScratchConfig section.
- Verify that the ScratchConfig.ConfiguredScratchLocation field contains the scratch setting that you configured in Step 6. If it does, reboot the host.
The host is now using the configured scratch partition.
For more information on determining whether a disk device is considered Local, see Identifying disks when working with VMware ESX (1014953), and review the Is Local flag in the output of the esxcfg-scsidevs -l command. If Local is true, the storage device is not sharable among multiple ESXi hosts. If Local is false, the storage device is remote and potentially sharable among several ESXi hosts. Remote devices are not automatically used for scratch by ESXi.
ESXi selects one of these scratch locations during startup in this order of preference:
- The location configured in the
/etc/vmware/locker.confconfiguration file, set by theScratchConfig.ConfiguredScratchLocationconfiguration option, as in this article. - A Fat16 filesystem of at least 4 GB on the Local Boot device.
- A Fat16 filesystem of at least 4 GB on a Local device.
- A VMFS Datastore on a Local device, in a
.locker/directory. - A ramdisk at
/tmp/scratch/
Here are two examples where scratch space may not be automatically defined on persistent storage. In each case, the temporary scratch location will be configured on a ramdisk:
- ESXi deployed on a Flash or SD device, including a USB key. Scratch partitions are not created on Flash or SD storage devices even if connected during install, due to the potentially limited read/write cycles available.
- ESXi deployed in a Boot from SAN configuration or to a SAS device. A Boot from SAN or SAS LUN is considered Remote, and could potentially be shared among multiple ESXi hosts. Remote devices are not used for scratch to avoid collisions between multiple ESXi hosts.
For configuring syslog on ESXi 5.x, see
Configuring syslog on ESXi 5.x (2003322)
Tags
See Also
- Rebooting an ESX Server host
- ESXi hosts without swap enabled cannot be added to a VMware High Availability Cluster
- Identifying disks when working with VMware ESX/ESXi
- Using Tech Support Mode in ESXi 4.1 and ESXi 5.x
- Cómo crear un área de almacenamiento permanente para datos temporales (Scratch) en ESXi
- Configuring syslog on ESXi 5.x
- Determining whether an ESXi host has persistent logging
- Como criar uma área de rascunho persistente para ESXi
- Crear una ubicación permanente para datos temporales en ESXi
- ESXi 4.x および ESX 5.x 環境での scratchの作成
This Article Replaces
Update History
Request a Product Feature
- Updated:
- Categories:
- Languages:
- Product Family:
- Product(s):
- Product Version(s):

