Unknown or Overlooked ESXi4’s Scripts and Commands


There are many scripts and commands listed in the /sbin folder on an ESXi4 host and many are just unknown for the majority of us, including me. I wanted to dig in and ran all of them just to ‘see’ what they do. I’ve intentionally left out in this article all the ESXCFG-* commands. I know there are the core commands but I wanted to shed some lights on the other commands and scripts that can be very useful in many issues but unfortunately many times just overlooked.

So, except the ESXCFG-* ones, here are my findings, the scripts and commands that are the most relevant for my day-to-day vAdmin tasks:

BootModuleConfig.sh

This script allows you to add or remove modules to the boot.cfg . cat /bootbank/boot.cfg | grep modules displays what modules are currently loaded.

auto-backup.sh

This script is pretty straight forward. It does automatically a backup of you ESXi host. The backup is stored in /bootbank under the name: state.tgz

backup.sh

This script allows you to backup the state of the host in a destination you defined as opposed to auto-backup.sh where it is by default in /bootbank

busybox

This is a multi-call binary, that is a single binary that you call for multiple defined functions and commands. VMware has tailored Busybox to their needs with limited set of functions and commands. At a command prompt, type ‘busybox’ then press Enter to have a complete list of supported functions and commands. You could eventually install the latest vanilla version from Busybox.net in the /tmp folder so it can survive a reboot. That version contains many more functions and commands such netstat which is surprisingly missing from the built-in Busybox.

cim-diagnostic.sh

This script allows you to dump all instances of the CIM. Whenever you need to troubleshoot issues with CIM, that’s the script to run first.

dcui

This tool will pop up the DCUI screen even in a SSH session. But the F2 and F12 functions keys don’t work.

firmwareConfig.sh

One of the parameters of this script allows you reset the firmware configuration to factory defaults and reboot. Useful when troubleshooting problem with an ESXi host and you want to revert to ‘factory’ defaults.

ft-stats

This tool gives you stats about VMs that are in FT mode. The tool assists you in troubleshooting issues with FT. One of the parameters allows you to force FT even though it didn’t pass the requirements. that can be useful in a home lab.

hwinfo

This tool lists info about the PCI devices and IRQs available to your ESXi host.

ipkg

This is a package management tool. By typing ipkg list_installed you will get a list of all packages installed on your ESXi host. Only official VMware packages are authorized.

lspci

This tool prints detailed information about all PCI buses and devices in the system. If you run nested ESXi, you will notice that virtual machine hardware is based on the famous Intel Corporation 440BX/ZX/DX chipset. That is true for VMware Player, Workstation, Fusion, Server and of course ESX/ESXi.

net-cdp

Running net-cdp -v prints out verbose and debug messages for CDP protocol.

partedUtil

This tool helps you troubleshooting issues with corrupt partition table for example. First you need to enumerate the storage devices: esxcfg-scsidevs -l Then you type in partedUtil get < Devfs Path>
The output looks like this: 1 128 157276349 251 0. 128 is the offset and 251 is the FB value for a VMFS partition type.

services.sh

This script is used to start, stop or restart services listed in /etc/chkconfig.db.  You could eventually edit the chkconfig.db to include extra services. On my nested ESXi host, the list contains the following services:

/etc/init.d/ntpd
/etc/init.d/hostd
/etc/init.d/vobd
/etc/init.d/slpd
/etc/init.d/wsman
/etc/opt/init.d/vmware-vpxa
/etc/init.d/sfcbd-watchdog
/etc/opt/init.d/vmware-aam

smbiosDump

This tool will dump the SMBIOS info and it’s quiet interesting. VMware hypervisor’s BIOS vendor is Phoenix Technologies LTD. Did you know that?

stat

This tool comes with Busybox. It displays some interesting stats for files and file systems. Do you want to know the block size set on a VMFS or NFS datastore? Type in stat -f < your datatstore here>. I’ve tested that against a NFS and VMFS datastore in my home lab, here is the output:

/sbin # stat -f /vmfs/volumes/QNAPNAS02NFSonSSD/
File: “/vmfs/volumes/QNAPNAS02NFSonSSD/”
ID: 0        Namelen: 127     Type: nfs
Block size: 4096
Blocks: Total: 38073304   Free: 18364512   Available: 18364512
Inodes: Total: 9223372036854775807 Free: 9223372036854775807

/sbin # stat -f /vmfs/volumes/QNAPNAS02iSCSI
File: “/vmfs/volumes/QNAPNAS02iSCSI”
ID: 0        Namelen: 127     Type: vmfs3
Block size: 8388608
Blocks: Total: 34528      Free: 31126      Available: 31126
Inodes: Total: 9223372036854775807 Free: 9223372036854775807

vmkperf

If you have this kind of error message: “Performance data is currently not available for this entity.“, you may use the following command: vmkperf resetall to reset events and counter which are not shared.

Feel free to comments especially if you have other ESXi4.0 scripts and commands you want to share with the community 😉

About PiroNet

Didier Pironet is an independent blogger and freelancer with +15 years of IT industry experience. Didier is also a former VMware inc. employee where he specialised in Datacenter and Cloud Infrastructure products as well as Infrastructure, Operations and IT Business Management products. Didier is passionate about technologies and he is found to be a creative and a visionary thinker, expressing with passion and excitement, hopefully inspiring and enrolling people to innovation and change.
This entry was posted in Uncategorized. Bookmark the permalink.

1 Response to Unknown or Overlooked ESXi4’s Scripts and Commands

  1. swamy says:

    Hi,

    Very nice post with a very good useful info.

    Thanks,
    SWAMY

Leave a comment