ESXi/ESX 4.x, 5.x and 6.x shutdown and reboot commands
search cancel

ESXi/ESX 4.x, 5.x and 6.x shutdown and reboot commands

book

Article ID: 338533

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

When virtual machines are running, ESXi/ESX might not clear the RAID controller's cache if you shut down or reboot the ESXi/ESX host using these commands on the service console:
  • reboot -f
  • halt
  • shutdown


Environment

VMware ESXi 4.1.x Installable
VMware vSphere ESXi 5.0
VMware vSphere ESXi 6.0
VMware vSphere ESXi 5.5
VMware ESX 4.0.x
VMware ESX 4.1.x
VMware ESXi 4.0.x Installable
VMware vSphere ESXi 6.5
VMware vSphere ESXi 5.1
VMware vSphere ESXi 6.7
VMware ESXi 4.1.x Embedded
VMware ESXi 4.0.x Embedded

Resolution

You can shut down or reboot ESXi/ESX 4.x or ESXi 5.x/6.0 hosts using any of the following methods:

Warning: Although these methods will gracefully shut down or reboot an ESXi/ESX host, they will not safely stop running virtual machines on the host. You should always ensure that virtual machines are migrated off the host and that the host is in maintenance mode before attempting to reboot or shut down a host using any method.
 

ESX 4.x

Log in to the ESX service console and perform one of these steps from the service console to shut down or reboot ESX 4.x hosts:
  1. Run the shutdown –r now command to reboot the system.

    Note: This command shuts down the virtual machines running on the ESX 4.0 hosts.
     
  2. Run the reboot command to reboot the system.
  3. Run the poweroff command to shut down ESX. After the shutdown, a message indicates that it is safe to power off your system. Press the power button until the machine powers off. You can then manually reboot the system.

ESXi 4.x/5.x/6.x

  1. From the Direct Console User Interface (DCUI) screen, press F12 to view the shutdown-related options for the ESXi host.
    • Press F2 to shut down.
    • Press F11 to reboot.
       
  2. From Local or Remote Tech Support Mode, or from an SSH session, run one of these commands:
    • Run the reboot command to restart the host.
    • Run the poweroff command to shut down the host.

    Note: In ESXi 5.x/6.0, no console output will be displayed on the screen when using the reboot or poweroff commands. After a short period of time, the host will reboot or shut down.

ESXi/ESX 4.x or ESXi 5.0

From the vSphere Client

Before shutting down or rebooting the ESXi/ESX 4.x or ESXi 5.0 hosts, ensure that the hosts are put into maintenance mode. Powering off a managed host disconnects it from vCenter Server, but does not remove it from the inventory.
  1. Shut down or use vMotion to migrate all virtual machines running on the ESXi/ESX hosts.
  2. Put the ESXi/ESX hosts into maintenance mode.
  3. Right-click the ESXi/ESX host that you want to shut down, and click Reboot or Shut Down.
     
    • If you select Reboot, the ESXi/ESX host shuts down and reboots.
    • If you select Shut Down, the ESXi/ESX host shuts down. You must manually power the system back on.
       
  4. Provide a reason for the shutdown or reboot. This information is added to the log.

ESXi 5.1/5.5/6.x

From the vSphere Web Client

Before shutting down or rebooting the ESXi 5.1 hosts, ensure that the hosts are put into maintenance mode.

To enter maintenance mode from the vSphere Web Client:
  1. Browse to the host in the vSphere Web Client navigator.
  2. Right-click the host and click Enter Maintenance Mode.
  3. Click Yes to enter maintenance mode.
Note: The host remains in maintenance mode until you select Exit Maintenance Mode.

To reboot or shut down the host using the vSphere Web Client:
  1. From the vSphere Web client, navigate to the host you want to shut down.
  2. Right-click the host and click Reboot or Shutdown.

From vCLI or vMA (vCLI 4.x)

Note: By default, the hostops.pl file in VMware vSphere CLI 4.0 U1 installations is located at C:\Program Files\VMware\VMware vSphere CLI\Perl\apps\host.
  • To put ESXi/ESX 4.x or ESXi 5.0 hosts into maintenance mode, run this command from the vMA (vSphere Management Assistant) or vCLI (vSphere Command-Line Interface) console screen:

    /usr/lib/vmware-vcli/apps/host/hostops.pl --target_host ESX-Host-FQDN --operation enter_maintenance --url https://vCenter-Host/sdk/vimService.wsdl
     
  • To reboot ESXi/ESX 4.x or ESXi 5.0 hosts, run this command from the vMA or vCLI console screen:

    /usr/lib/vmware-vcli/apps/host/hostops.pl --target_host ESX-Host-FQDN --operation reboot --url https://vCenter-Host/sdk/vimService.wsdl
     
  • To shut down ESXi/ESX 4.x or ESXi 5.0 hosts, run this command from the vMA or vCLI console screen:

    /usr/lib/vmware-vcli/apps/host/hostops.pl --target_host ESX-Host-FQDN --operation shutdown --url https://vCenter-Host/sdk/vimService.wsdl

From vCLI or vMA (vCLI 5.x/6.0)

Note: For more information on the vicfg-hostops command, see the vSphere Command-Line Interface Reference documentation.
  • To put ESXi/ESX 4.x or ESXi 5.x/6.0 hosts into maintenance mode, run this command from the vCLI (vSphere Command-Line Interface) console screen:

    vicfg-hostops.pl --server ip_address --username root --password password --operation enter
     
  • To reboot ESXi/ESX 4.x or ESXi 5.x/6.0 hosts, run this command from the vCLI console screen:

    vicfg-hostops.pl --server ip_address --username root --password password --operation reboot
     
  • To take ESXi/ESX 4.x or ESXi 5.x/6.0 hosts out of maintenance mode, run this command from the vCLI console screen:

    vicfg-hostops.pl --server ip_address --username root --password password --operation exit
     
  • To shut down ESXi/ESX 4.x or ESXi 5.0 hosts, run this command from the vCLI console screen:

    vicfg-hostops.pl --server ip_address --username root --password password --operation shutdown
Note: For more information, see Running VMware CLI 4.x commands on ESXi 5.0 hosts (2004291).

Additional Information

For translated versions of this article, see: