Since vSphere 5, the only hypervisor available in the VMware virtualization suite is ESXi. One of the main differences in ESXi compared to ESX is the lack of Service Console, which was basically stripped down RHEL used for communicating with VMkernel. As a result, CLI command syntax in ESXi siginificantly differs.
This post covers a few of the most important CLI commands in ESXi, while One of the future posts will cover esxcli, a new CLI framework that will in future completely replace legacy esxcfg-*/vicfg-* commands.
You can directly access command line in ESXi 5.x either through the console (so called ESXi Shell) or SSH, but you need to first enable it through vSphere Client (Configuration -> Security Profile -> Services -> ESXi shell / SSH -> Options -> Start) or console menu (F2 -> login as user with root privileges -> Troubleshooting Options -> Enable ESXi Shell / Enable SSH).
Show services on the host and their default state upon boot (on/off)
cat /etc/chkconfig.db
Restart all services on the host
/sbin/services.sh restart
Show config file of vCenter vpxa agent
cat /etc/vmware/vpxa/vpxa.cfg
Enter maintenance mode
vim-cmd hostsvc/maintenance_mode_enter
Virtual machine operations
vim-vmd solo/registervm <path to VM's .vmx file> - register VM on a host
vim-cmd vmsvc/getallvms - list all VMs registered on the host
* in the following commands replace <vmid> with virtual machine ID obtained by running the previous command
vim-cmd vmsvc/power.getstate <vmid> - show power state of a VM
vim-cmd vmsvc/power.shutdown <vmid> - shutdown a VM (shutdown guest)
vim-cmd vmsvc/power.reset <vmid> - reset a VM
vim-cmd vmsvc/power.off <vmid> - power off a VM
vim-cmd vmsvc/power.on <vmid> - power on a VM
vim-cmd vmsvc/power.reboot <vmid> - reboot a VM
vim-cmd vmsvc/get.summary <vmid> - get summary information for a VM
vim-cmd vmsvc/unregister <vmid> - unregister a VM from a host
No comments:
Post a Comment