Product Announcements

Ops changes part 5 – Scratch partition

When implementing ESXi the first noticeable difference in the architecture is the partition layout.With ESX classic you always had the ability to customize your partition layout and many used the obvious "Linux" partition scheme with a /tmp, /opt, /var and /home. This however as changed with ESXi and there isn't actually much left to discuss… well except for the Scratch Partition that is.

The question of course is what is it used for and when is it created and can I modify it?

The Scratch Partition is used for a couple of things:

  1. Store vm-support output (if scratch partition is unavailable the output will be stored in memory)
  2. During first boot the partition will be configured through syslog for retaining logiles
  3. Userworld swapfile (when enabled)

In the past, as some might remember, you needed to create this partition yourself. As of vSphere 4 Update 1 this is done automatically for you when you install ESXi Installable and the installer detects a disk a partition will be created. You might wonder why the change in behavior, well the reason for it being of course to have an area where detailed troubleshooting information can be stored. I guess our documentation explains it fairly well:

The scratch partition is not required. It is used to store vm-support output, which you need when you create a support bundle. If the scratch partition is not present, vm-support output is stored in a ramdisk. This might be problematic in low-memory situations, but is not critical. For ESXi Installable, the partition is created during installation and is thus selected. VMware recommends that you leave it unchanged.

As stated earlier, not only vm-support output but also logfiles and userworld swap (if enabed). All of this means that although not specifically required as mentioned in our documentation, from an operational perspective there is very much a requirement to have a scratch partition in place. So if in any case a scratch partition is not automatically created, for instance when using USB/SD as boot device, make sure you define your scratch partition, either on local or on remote storage. Of course vSphere offers you multiple ways of doing this:

Tech Support Mode / Scripted Install:

vim-cmd hostsvc/advopt/update ScratchConfig.ConfiguredScratchLocation string /vmfs/volumes/storage1/<unique-name>

vCLI:

vicfg-advcfg.pl –server <hostname> –username root -s /vmfs/volumes/storage1/<unique-name> ScratchConfig.ConfiguredScratchLocation

PowerCLI:

Set-VMHostAdvancedConfiguration -VMHost (Get-VMHost <fqdn-hostname>) -Name "ScratchConfig.ConfiguredScratchLocation" -Value "/vmfs/volumes/storage1/<unique-name>"

Thanks to Alan Renouf for providing the line of PowerCLI code. By the way, Alan also provided a line of code to list all the host and the current Scratch Location, might come in handy some day:

New-VIProperty -ObjectType VMHost -Name ConfiguredScratchLocation -Value {($Args[0] | Get-VMHostAdvancedConfiguration ScratchConfig.ConfiguredScratchLocation).Values } -Force

Get-VMHost | Select Name, ConfiguredScratchLocation

vCenter:

  • ESXi host
  • Configuration
  • Software
  • Advanced Settings
  • ScratchConfig
  • ScratchConfig.ConfiguredScratchLocation

Please note that the location needs to be unique for every ESXi host and again, if it has been set by the installer I recommend to leave it to the default settings. Also don't forget to reboot your host after making changes to the Scratch Partition setting.