There are two VMware ESX commands that every VMware ESX administrator should know and master:
- service mgmt-vmware restart
- service vmware-vpxa restart
You may notice that for almost every VMware problem I blog about, the first step in troubleshooting is almost always restarting the management services. The reason for this is simple, it is the quickest and easiest way to fix a majority of the ESX problems experienced. I would compare it to restarting Windows in order to fix a Windows OS problem.
So what do these two services actually do?
The mgmt-vmware service’s primary goal is to restart hostd. Hostd is an application that runs on the Service Console that has insight to what the ESX host manages. This includes the VMs registered on the host, operations performed on registered VMs, datastores configured on the host, and web connections to the Service Console.
The vmware-vpxa service is responsible for communication between the ESX host and vCenter Server. It is only installed when an ESX host is connected to a vCenter Server instance. This service communicates directly with the mgmt-vmware service.
In addition to knowing what the services being restarted do, there are several important things to note when restarting them:
- The order of service restarts is important; mgmt-vmware should always be restarted first followed by vmware-vpxa
- Restarting the management agents may impact any tasks that are running on the ESX host at the time of the restart
- Ensure Automatic Startup/Shutdown of virtual machines is disabled before running this command or you risk rebooting virtual machines (see KB article: 1003312)
- Restarting management services may take a couple minutes to complete (background processes are spawned so while the command returns OK it may not have completed yet)
- Restarting management services may cause the ESX host to become temporarily unavailable from vCenter Server causing alerts if configured to do so
Finally, it should be noted that restarting management services can fail for a variety of reasons. The mgmt-vmware service is almost always the culprit and typically fails because of hostd. If the mgmt-vmware service fails to stop, start, or hangs when starting, you may need to manually restart hostd. First, try to restart the service again as this does resolve the issue on occasion. Otherwise, you can manually restart the service by running the following commands:
# kill -9 `cat /var/run/vmware/vmware-hostd.PID`
# rm -rf /var/run/vmware/vmware-hostd.PID
# kill -9 `cat /var/run/vmware/watchdog-hostd.PID`
# rm -rf /var/run/vmware/watchdog-hostd.PID
# service mgmt-vmware restart
More information about this problem and resolution is available at: http://kb.vmware.com/kb/1005566.
So now you know the two most important ESX commands, what they actually do, and why they may not restart properly. I hope you find this information as helpful as I do!
© 2010 – 2013, Steve Flanders. All rights reserved.