WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Resources
    • Nested Virtualization
  • VMware Nostalgia
  • Apple
You are here: Home / How to Automate Host Cache Configuration in ESXi 5

How to Automate Host Cache Configuration in ESXi 5

07.28.2011 by William Lam // 1 Comment

ESXi 5.0 now supports a new feature called Host Cache which allows a user to offload the virtual machine's swap onto a local SSD device for performance, this can be very helpful for VMware View deployments or other VDI type deployments on vSphere 5.

Currently this is a manual process in which a VMFS volume must be created on an local SSD device and then configured to be used as a Host Cache datastore under the host configuration section. There are two ways of automating this whether this is done during the kickstart process which I am a fan of or as part of a post install process.

Method #1

In the first option, the process involves formatting and creating a VMFS volume on a local SSD devices and using a little python to connect to the vSphere MOB to perform the host cache configuration. Here is a snippet of what the kickstart would look like as part of the %firstboot section:

The script uses the partedUtil to format the local SSD and then using vmkfstools to put a VMFS volume and then finally connecting to the vSphere MOB to configure host cache.

Method #2

In the second option, I wrote a vSphere SDK for Perl script hostCacheManagement.pl using the vSphere APIs to manage and configure host cache datastores after an ESXi 5 host has been built. The script supports three options: list, enable and disable and will also validate that datastore being specified are SSD datastores.

Download the hostCacheManagement.pl script here.

Here is an example of listing all SSD datastores and whether or not they are being used for host caching:

Here is an example of enabling an SSD datastore for host cache:

Note: Make sure your "--swapsize" is less than or equal to the size of your SSD datastore else an error will be thrown. VMFS does take up some space for its metadata/etc.

Here is an example of disabling an SSD datastore for host cache:

Here is an example if you try to specify a non-SSD datastore, an error will be thrown:

More from my site

  • How to Trick ESXi 5 in seeing an SSD Datastore
  • Running ESXi 5.0 & 5.1 on 2012 Mac Mini 6,2
  • Nested Virtualization Resources
  • That's so cool! Running ESXi 5.0 & 5.1 on Apple Mac Mini
  • vSphere Security Hardening Report Script for vSphere 5

Categories // Uncategorized Tags // ESXi 5.0, host cache, ssd, vSphere 5.0

Trackbacks

  1. Automating ESXi 5 Kickstart Tips & Tricks | virtuallyGhetto says:
    03/02/2014 at 6:27 pm

    […] is a post on how you can automate host cache configuration.  […]

    Reply

Leave a Reply to Automating ESXi 5 Kickstart Tips & Tricks | virtuallyGhettoCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search

Thank Author

Author

William is Distinguished Platform Engineering Architect in the VMware Cloud Foundation (VCF) Division at Broadcom. His primary focus is helping customers and partners build, run and operate a modern Private Cloud using the VMware Cloud Foundation (VCF) platform.

Connect

  • Bluesky
  • Email
  • GitHub
  • LinkedIn
  • Mastodon
  • Reddit
  • RSS
  • Twitter
  • Vimeo

Recent

  • Programmatically accessing the Broadcom Compatibility Guide (BCG) 05/06/2025
  • Quick Tip - Validating Broadcom Download Token  05/01/2025
  • Supported chipsets for the USB Network Native Driver for ESXi Fling 04/23/2025
  • vCenter Identity Federation with Authelia 04/16/2025
  • vCenter Server Identity Federation with Kanidm 04/10/2025

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2025