Move ESXi Scratch Location

Loading


A swap file serves as a repo store for the virtual machine’s vRAM contents.

This swap file is created in the same location as the virtual machine configuration file by default which is controlled by the Cluster settings. As the Virtual Machines are powered on the swap file is created without which the VM won’t power up.

Verify the default swap configuration applied to VM by going to the cluster level

Cluster > General > Swap file location

Swap files can be stored under the same directory where the VM’s virtual machine config files are stored or we could just keep them on a central datastore

If we go and check individual VM’s we can observe all the VM’s under the cluster will have the same cluster settings being applied across.

Modifying ESX Scratch Partition


On the ESX host, all our troubleshooting information such as logs, core files etc are stored in the scratch partition.

ESXi hosts which are booting from USB flash media do not have a permanent scratch location. Instead a path /tmp/Scratch will be mapped into their ram disk. A reboot of the host results in all logs being lost and that could be an issue when it comes to troubleshooting. If the scratch partition is not reachable during an esx outage, the ESXi will function however tasks such as vMotion etc wont work as required.

By default, it’s now a requirement in ESX 7.X that we create a scratch partition.In this process we will change the default scratch location on an ESXi host to a shared datastore.

Place the host into maintenance mode

We will need a shared datastore and its datastore id to create map our scratch partition onto that, the easiest way to locate this info is from the datastore level.

Go to the datastore section and select Summary and note the datastore iD

/vmfs/volumes/60cfa1fd-736dc132-6461-00505694fdb8/ is the datastore ID we need

Browse to the files section and create a new folder

Create a folder as .scratchlogs . The .Scratch would indicate its a hidden folder

Our datastore path to the .scratchlogs will be /vmfs/volumes/60cfa1fd-736dc132-6461-00505694fdb8/.scratchlogs

Go to esx host > Configure > System > Advanced System Settings

Search for scratch in the Advanced System Settings which will show the current scratch destination configured.

Search for “scratch” and you will see two enteries as shown

  • ScratchConfig.ConfiguredScratchLocation
  • ScratchConfig.CurrentScratchLocation

You need to enter the entire path to the scratch location you’ve created before at ScratchConfig.ConfiguredScratchLocation

Once the configuration has been applied restart the esx host. After the restart if you browse the corresponding location in the datastore you will see below folder structure.

After a reboot you can check the value at ScratchConfig.CurrentScratchLocation and it will be persistent

(Visited 1,652 times, 1 visits today)

By C A Thomas

Chinchu A. Thomas is an Infrastructure Analyst specializing in Microsoft Azure, the Microsoft 365 suite, AWS, and Windows infrastructure management products.

Leave a Reply