Creating a persistent scratch location on ESXi

When you install your ESXi host(s) on a flash drive, which is pretty common in an enterprise environment you will get a message on the Summary tab in your vSphere client or Web client interface “System logs on <ESXi host> are stored on non-persistent storage“.

Persistent Scratch Location on ESXi     Persistent Scratch Location on ESXi

This is because system log files which are required for auditing and diagnostic purposes must be stored on a datastore, or they will not be available after a host reboot; they will disappear. The place where these log files are kept on a datastore is also called a Scratch location. Before you start setting up the scratch location you need to make a decision which datastore you are going to use for this; and is recommended to have a dedicated datastore. After you decided, you need to find the datastore location on your ESXi host, and as you can see in a moment, that location is not something that you can remember easily.

In your vSphere client go to Configuration > Storage and click the datastore that you want to use for the Scratch location. In the details section you can see the datastore location on the ESXi host; actually is just a mapping but we need this location in order to move forward. Write that path down in Notepad or something.

If you are using vCenter you will need to go to the Storage section and select your datastore. Then go to Manage > Settings > Connectivity and Mutipathing. The exact same information is shown like in the vSphere client.

The second option, more preferred by some people is to SSH into the ESXi host to get the datastore path. Once connected type:

cd /vmfs/vloumes

then

ls -l

This will list all the datastores on that ESXi host. Select the datastore uniquely identifier to copy it on the clipboard.

Persistent Scratch Location on ESXi

On the vSphere client right-click the datastore that you selected for the scratch location and choose Browse Datastore.

If you are in a cluster environment make sure this datastore is seen by all ESXi hosts that are part of that cluster.

Persistent Scratch Location on ESXi     Persistent Scratch Location on ESXi

I usually create a folder here named Scratch, and in this folder I created another one with the name of my ESXi host. It is up to you how you organize and name this folders. When you are done, close the Datastore Browser.

Persistent Scratch Location on ESXi     Persistent Scratch Location on ESXi

You could do this form the SSH console too. Just change directory to your datastore then use the mkdir (make directory) command to create the folders.

Persistent Scratch Location on ESXi

Select your ESXi host, go to the Configuration tab, then click the Advanced Settings link; select the ScratchConfig option. In the Web client go to Manage > Settings > Advanced System Settings and search for the ScratchConfig.ConfiguredScratchLocation option.

Persistent Scratch Location on ESXi     Persistent Scratch Location on ESXi

Type the datastore path in the form /vmfs/volumes//folder/subfolder. In my example is /vmfs/volumes/52b74734-07e9331c-974a-000c29083561/Scratch/ESX1. Remember that I’ve created the Scratch and the ESX1 folders manually on my datastore. The name must start with /vmfs/volumes/ and end with the folder name or is not going to work. After you typed the scratch location click OK to save the changes.

Persistent Scratch Location on ESXi     Persistent Scratch Location on ESXi

All that is left now is to reboot the ESXi host(s).

If you are in a production environment make sure you put the host(s) into maintenance mode first so the VM’s can be migrated to other hosts in the cluster. If the ESXi server is not part of a cluster, make sure you do this after hours because the VM’s will be powered off.

After reboot the message should not be displayed any more

Persistent Scratch Location on ESXi

and if you browse the datastore, the logs should be in the new location.

Persistent Scratch Location on ESXi     Persistent Scratch Location on ESXi

Want content like this delivered right to your

email inbox?


Leave a Reply

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

*

css.php