A handful of ESXi tips and tricks

Updated: June 8, 2011

I have not given ESX much spotlight on Dedoimedo. We shall summarily rectify that. After my simple tutorial on how to clone virtual machines in ESXi, it's time to expose you to some more VMware goodness. ESXi is a bare-metal hypervisor, offered for free. It's the next stepping stone toward the most expensive and most capable ESX virtualization solution.

Just in case you're wondering, there's VMware Player and then, there's Workstation, which are oriented toward home users. There's also VMware Server, which is a free demonstration version of what ESX can do, on a much smaller scale than ESXi. And then, there's ESXi; it has a few purposefully built-in limitations. Call them locked bonuses, if you will, just like in racing computer games. To get most of your ESXi, you need some extra work, hence this tips and tricks article.

Teaser

Micro disclaimer

I'm not a VMware expert - just an enthusiastic user. Even so, I think my articles on the subject should help you around. That said, there's a handful of excellent resources listed in the More reading section further below. OK, now let's do it.

Optimize guest performance

Running at full speed is important, especially if you have multiple virtual machines contending for limited resources. You want to be able to leverage and balance the system usage in the best manner possible. We want best performance, without harming or limiting functionality.

This can be done by editing advanced virtual machine properties. Note, all of the parameters shown in the GUI here can be set manually in the virtual machine configuration files. I'm going to show you GUI here and leave the command line for another tutorial.

Some of the more important parameters include:

Exposing/hiding the Nx flag, which increases VMotion compatibility between hosts. VMotion is a payware feature, so if you don't plan on using it, hide the Nx flag to improve the guest performance. Now, there is no blanket setting that works for everything, so you will need to examine if this setting applies to your machines.

Advanced options 1

Paravirtualization allows supported guest operating systems to run with significantly improved performance, provided they can tell they are being run paravirtualized. Some operating systems will simply refuse to run this way. Others won't be impacted at all. Your best bet is Linux, in this case.

Advanced options 2

Please note that your guest needs to be aware/support paravirtualization. This means the kernel has to be compiled with paravirtualization and VMI options enabled.

CONFIG_PARAVIRT=Y
CONFIG_VMI=Y

In general, recent Linux kernels come this way. However, ESXi supports paravirtualization for 32-bit guests only, so make your choices accordingly.

Hardware Page Table Virtualization is another performance facility, when used correctly. Again, based on your CPU and specific workloads, you may benefit from using it. Like the rest, this option hides in the Advanced menu options.

Advanced options 3

Swapfile location can be a major performance booster. If your disk array is slow, running several virtual machines at the same time could lead to a serious performance penalty, especially if they are all swapping. To reduce IO thrashing, you may want to use multiple swapfiles, dispersed across several storage devices. By default, ESXi will use settings available on the host. For best performance, you may want to use a dedicated datastore.

Advanced options 4

Boot delay

Say you want to install your guest from a CD or an ISO image. No worries, you just need to change the boot priority to use CD-ROM before hard disk or network. However, by default, ESXi BIOS has no delay, which can cause some frustration in trying to get the desired result.

No problem; you can manually specify the machine boot delay in the configuration options. You can also force the next boot to enter the BIOS setup screen, which might be useful for your specific demands.

Boot delay

Extra options

Now, if you find some of the features or options missing, you can always manually add lines to the virtual machine configuration file. You don't have to burrow into the datastore and look for the right .vmx file, although, in general, if you plan on scripting and automation, you should.

In the virtual machine properties window, under Option, Advanced, General, there's a button that says Configuration Parameters. This is what we want.

Main window

The Configuration Parameters window is a simple name, value table, where you can input pretty much any VMware option. You can also use experimental features, but beware breaking your vendor support model. You can add extra rows, but you can't delete them from within the management interface. This sort of things will mostly appeal to skilled and very advanced users with special needs.

Configure params

Finally, under Resources, you can setup all kinds of CPU, memory and disk options. For instance, you can choose what kind of hyperthreading sharing mode to use, provided your CPU supports it and the feature is enabled in BIOS. You can also set the processor affinity, forcing virtual machines to run on specific processors only. While proper tweaking can bring about immense performance gains, you can also very easily cripple your mode of work by using incorrect settings.

For example, if you know you'll be using  a virtual machine that will normally running an application that forks lots of children, forcing it to run on a single core could lead to a performance loss. Similarly, parallel compilation or execution of workflows will be significantly affected by hyperthreading and CPU affinity. Food for thought.

Resources

Time sync

There could be many reasons why you'd want to have time sync enabled or disabled in your virtual machines, including Kerberos tickets, software updates, program licenses, a careful order of execution of cron jobs between different hosts, and more.

To this end, you can fine-tune your NTP configuration - start/stop the NTP service, choose the NTP server, choose the port number, and more. Depending on your needs, you might have to change these, although most will benefit from default options.

Configure time

Options

Enable SSH to your ESXi server

This is probably the most important tip. Alas, no screenshots as I've done this on an actual machine, although I could have, in theory, installed ESXi from ISO as a guest on top of another ESXi and then shared the screenshots. But you'll believe me. And there's also a link to a similar tutorial, with images and whatnot, further below.

ESXi has two virtual consoles (a typical Linux has seven), which you can access and toggle by using Alt + F1/2 combo. VC2 is the pseudo-GUI management console. VC1 is the sort of tailed server log. No command line, allegedly.

However, if you type unsupported in this window, you will get command line. This is the first step. Next, we need to enable SSH. This is done slightly differently from typical Linux boxes.

Open /etc/inetd.conf in a text editor (vi). Search for the ssh line and uncomment it. Save the file and exit. Now, you need to restart inetd to get it to reread its configuration and startup with SSH enabled.

To restart inetd, locate its process in the process table:

ps -a | grep inetd

After you locate the inetd process ID (PID), restart it:

kill -1 <pid>

Note: This is an unsupported feature. Please consult with your IT support, vendor, whoever if you want to do this, as you may accidentally break warranty or similar. In general, since you are using a free and unsupported product, this should not be a problem.

More reading

Some of the tips below are applicable only for ESX, but they should be useful anyhow. Moreover, some of the work refers to older versions of VMware products, but you should still have a good, long read.

vm-help.com (best, most comprehensive source I know)

How to access the VMware ESXi hidden console (great tutorial, screenshots)

VMware Remote Command Line Reference Guide (direct link, PDF)

Guide to VMware ESX Server 3

How to administer VMware ESX Server

Conclusion

For all practical purposes, this guide won't turn you into a VMware guru. But it could shed some light on the few less obvious options and features hidden in the GUI, including performance tweaks and more streamlined virtual machine management. While graphical use offers convenience, it can lead to a productivity loss down the road. But then, you have the command-line console and SSH to compensate for that.

Today, you have learned a number of valuable tips that should kickstart your work with VMware virtualization products. In the future, we will discuss other common scenarios and usage models before eventually digging into the scripting and command-line only mode.

Enjoy your virtualization.

Cheers.