ESXi and The Command Line

ESXi isn't the end of the line for our beloved command line.

At a training class I attended, among the first comments from the instructor was that everything a virtualization administrator would ever want to do can be done through the VI Client. I quickly piped up and told the instructor that this was incorrect, as frequently we need the command line for many tasks. With VMware ESXi, we have obstacles in going about some of these tasks. Let me share with you how to get into some of the internal elements of ESXi that are not so obvious.

The main reason I went about this task is to be able to manage virtualized storage properly. For most storage systems, it's not really necessary to have command line access to the storage system, as ESX through the VI Client displays the most pertinent information regarding storage in the interface. In the case of virtualized storage, it is not as obvious to distinguish one piece of storage from another.


I have become quite versed with the esxcfg-mpath command for this very reason.

In ESXi, this was made difficult by no default command line interface (CLI). There is a CLI for ESXi, and the examples below show how to crack it open and get the information you need. Above all, these configuration changes to ESXi are officially technical support tools and go into an unsupported configuration -- so, the obligatory "use at your own risk" statement applies. To get into the console on ESXi, take these steps:

  1. Press ALT+F1
  2. Enter the text: unsupported (press Enter)
  3. Then type the root password for the ESXi installation (note the text will not be displayed)

If you enter the console correctly, you'll see what's in Fig. 1.

ESXi in Tech Support Mode
[Click image to view larger version.]
Figure 1. ESXi shown going into Tech Support Mode. Use with caution.

Once in the console, we can do our base commands, such as the esxcfg-mpath command to retrieve disk information. The main piece of information I frequently use esxcfg-mpath for is to get the serial number of a logical unit number (LUN). This is relevant more so in virtualized storage environments, and to a lesser extent, direct attached storage configurations.

Running the esxcfg-mpath command
[Click image to view larger version.]
Figure 2. The multi path storage management command is being run on the ESXi console.

If you are in the limited console function of ESXi and need to return to the grey and yellow screen where it normally resides, simply press Alt+F2. This does not log out the root session on the console; however typing "exit" will do so.

The next question that comes up is, how do I use SSH to run these commands so I don't have to use a console? This is possible by modifying the /etc/inetd.conf file on the host. Open the file in a vi editor and find the #ssh line. Remove the hash symbol and restart the server. At that point, SSH connections will be permitted.

These are not configurations delivered with the product, so I emphasize that these should used on an as-needed basis. Yet I'm still convinced ESXi is the way to go. There is a learning curve, but it is not something we can't undertake. Let me know if this helps or if there is more you want to see on ESXi.


About the Author

Rick Vanover, MCTS, MCSA, MCT, is an IT Infrastructure Manager for Alliance Data in Columbus, Ohio. With years of IT experience in system administration, technology management and software engineering roles, Rick has a solid foundation of infrastructure in a virtual world. Rick is a columnist for Virtualization Review Magazine in the Everyday Virtualization blog as well as other online technology publications. Rick can be reached at: vanover-rick@usa.net.

Reader Comments:

Sun, Sep 20, 2009

Any decent linux user have done this since the first version of esxi was released. The problem we face is that the current versions of esxi have crippled the API layer. Dang! We are left with Xen and KVM or make our moves to Hyper-V R2 Server...

Mon, Aug 10, 2009

The vmware rcli has many of these commands, including esxcfg-mpath. These can be run from a Windows or Linux host without having to login to the ESXi console or resort to enabling ssh.

Add Your Comment:

Your Name:(optional)
Your Email:(optional)
Your Location:(optional)
Comment:
Please type the letters/numbers you see above