Enabling ESXi Persitent Scratch Partition

An ESXi scratch partition is a 4GB VFAT partition created during autoconfiguration phase while installing ESXi. A scratch partition is only needed to store vm-support output when a vSphere admin is creating a support bundle. While doing so, If an ESXi host is not able to find any scratch partition to store the vm-support bundle, it will simply store it in the ramdisk. And there are a few gotchas in doing it this way:

  • The maximum size for vm-support files stored in memroy is only 512 Mb. If the file exceeds this size, you might run into problems to generate it.
  • In low-memory situations, storing vm-support output might get problematic when running lots of VMs as the memory will get restrained.
  • If the ESXi host is rebooted for some reasons, you’ll automatically loose the VMkernel logs.

The scratch partition is automatically created on persistent storage during the ESXi installation anyway, so you might not face any of these issues mentioned above. However, there are some situation where it is not the case. ESXi will use the memory to create the scratch partition in one of either below cases:

  • If ESXi is installed on a Flash, SD device or USB key, due to the potentially limited read/write cycles available.
  • If ESXi deployed in a Boot from SAN configuration or to a SAS device. Because A Boot from SAN disk is considered remote, and remote devices are not used for scratch to avoid collisions between multiple ESXi hosts.

Adding to this, It is worth noting that, VMware has a KB article stating that you might run into problems if you’re not using persistent scratch partitions and using Update Manager in your environment to update your ESXi hosts.

Because of all points mentioned above, having persistent scratch partition is actually always a good thing.

How to Create a Persistent Scratch Partition

It is fortunately very easy to create a persistent scratch partition for you ESXi hosts if you don’t have one configured already, and this is done in two steps

  • Create a dedicated directory to store the scratch partition in the ESXi datastore (shared or local).
  • Change the scratch partition in the host advanced configuration settings.

The thing to note here, is that this procedure needs to be done for every ESXi host you have in your environment, and you can create the scratch partition in either a local or a shared datastore. If you are doing it in a shared datastore, create a separate folder in the datastore for each of your host, to avoid any situation where the hosts overwrite each other’s data.

To create a permanent scratch partition to your ESXi hosts, folow below procedure

Connect to vCenter Server > Go to Datastores > select a Datastore > Go to the Files tab > Create a folder for this ESXi host named for example “scratch-esx1”

Select a host > Go to Configure > Go to Advanced System Settings section > Click Edit

Search for ScratchConfig > Change the ScratchConfig.ConfiguredScratchLocation to the path of the new scratch partition. Simply append the Datastore path with the folder name like this /vmfs/volumes/ESX1-LDS/scratch-esx1

You will need to put the host in maintenance mode and reboot it for the configuration to take effect.

Best Practice Related to Scratch Partition Location

One of the Best Practices for VSAN is to not use the VSAN Datastore for the Scratch Partition or for the Syslog Server. As per this VMware KB, It is not supported to configure a scratch location on a VSAN datastore, even though it is technically possible.

The reason for this is that you will not able able get out an ESXi from a vSAN cluster, as it’s impossible to release the configured scratch partition that is locked in the vSAN Datastore.

In case you face this issue, just connect directly to your host using the vSphere Client and change the Scratch Partition to another folder, and only after doing that, you’ll be able to exit the host from the vSAN cluster

Leave a Comment

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