Esxcfg-info

From VI-Toolkit
Revision as of 20:55, 18 February 2009 by Wila (talk | contribs) (added category)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

esxcfg-info

The esxcfg-info command can be used to query the setup information of your ESX configuration and hardware setup. The tool is originally designed for debugging/troubleshooting your ESX configuration. Before ESX3.x this type of information could be retrieved from /proc/vmware but that use has now been depreciated and you should instead use this command.

The output of the esxcfg-info command does change per version of ESX, for this reason you should be careful when using it in scripting and not to rely too much on the format. This dependency has been improved upon since ESX 3.5 by adding output formats that are more suitable for scripting.

Calling it with -a or -all parameter will print out all information unfiltered. The output can be used to save as a backup of your host setup. If you ever have to reinstall the host then this file can then be used as a baseline for verification if your setup matches the old configuration.

The command has the following additional options where most of them can be used to filter the output:

-n --network
   Display the console and VMkernel network relevant configuration
-s --storage
   Display everything about storage
-w --hardware
   Display the hardware configuration from your server
-y --software
   Display the software configuration of your ESX host
-r --resource
   Get resource and schedule information
-o --advopt
   Get advanced options
-h --help
   print help

ESX3.5 has added the following options:

-F xml for formatting the output as xml
-F perl for formatting the output format for scripting with perl.

Usage examples

By combining the output of the esxcfg-info command with grep you can retrieve interesting information from your host. Following are a number of examples of what you can do with this.

Check 64 bits

You can use esxcfg-info as a way to check if your host is 64 bits capable AND if VT is enabled in the BIOS.

esxcfg-info -w | grep HV

should return

|----HV Support...............................................3

when it returns 2 it means that the host is capable, but that VT has not been enabled in the bios.

See also: How to tell if your host is 64 bit compatible without a reboot?

Currently configured VLAN tags

You can retrieve what VLAN tags are configured on a physical switch that the ESX server connects to by querying for either the "_name" or the "Hint" keyword in the network part output from the esxcfg-info command.

To see a list of all of the network hints for each adapter run:

esxcfg-info -n | grep -E -i "_name|hint"

taken from: esxcfg-info question

Find storage device
esxcfg-info -s | grep vmhb | grep -i vmkernel

which should give an output like:

|---VmKernel Device Name..................vmhba0


Identify LUN locks

How-to identify hosts with unreleased SCSI reservations on LUNs.

esxcfg-info -s | grep -i -B 12 pending

LUN locks

Find software iSCSI vmhba number

By querying 2 lines before the iscsi kernel module, you can find the name of the vmhba device used for the software iSCSI stack:

root# esxcfg-info -s | grep -B 2 iscsi_mod
|----Name...............................................vmhba34
|----Console Name.......................................scsi3
|----Driver.............................................iscsi_mod

esx 3.5 (unix) command line to get the S/W iSCSI vmhba number