Basic commands for VMware

chkconfig -–list, chkconfig –level

chkconfig –list | grep –i hp*

service servicename start/stop/restart

find / -iname ‘*.vmx’

vmware-cmd -l — lists all virtual machines registered on a host

Vmware-cmd <path of vmx> start/stop/reset trysoft

vmware-cmd <path of vmx> getstate

vmware-cmd <path of vmx> getheartbeat

shutdown –h –t secs 1;

Shutdown –r 1; reboot

rpm -Uivh *.rpm


For 3.0 hosts, you simply just run ps -ef | grep -i <servername>

Then you just kill that process and the server will power off.  Then you power it back on.


For ESX 2.5 Hosts,

vmware-cmd /home/vmware/WDBSSDBTPT02/WDBSSDBTPT02.vmx getpid

(Result of this command shown below)

getpid () = some number

then simply run ps -ef | grep some number

then kill some number

ps aux | grep -i <Virtual Machine Name>

kill -9 <process id>

ps –auxfww | grep –i <virtual server name>


To enter host into maintenance mode from SVC Console

vimsh -n -e /hostsvc/maintenance_mode_enter

To exit maintenance mode from SVC Console

vimsh -n -e /hostsvc/maintenance_mode_exit

To Check whether host is in maintenance mode.

vimsh -n -e /hostsvc/runtimeinfo | grep inMaintenanceMode | awk ‘{print $3}’


tar -czvf filename.tar.gz (tgz) <file to compress and archive>

tar -xzvf filename.tar.gz  (tgz)

tar –cvf  filename.tar

tar -xvf filename.tar


vmware-cmd -s register /vmfs/path/to/vmx/file.vmx

The output should state:  register (path to your vmx) = 1

vmware-cmd -s unregister /vmfs/path/to/vmx/file.vmx


command line to commit snapshot

1)     Type vmware-cmd /vmfs/volumes/UUID/VMNAME/VMNAME.vmx hassnapshot  and press Enter to confirm that there is a snapshot. If the output displays a blank value or value of 1, a snapshot is present. If the output displays a value of 0, there is no snapshot present.
2)     Type vmware-cmd /vmfs/volumes/UUID/VMNAME/VMNAME.vmx createsnapshot “<name>” and press Enter to create a new snapshot.
Note: You can use any name you like. The name appears in the snapshot manager.
3)     Type vmware-cmd /vmfs/volumes/UUID/VMNAME/VMNAME.vmx removesnapshots and press Enter to remove the snapshot.


vmkfstools -i  <delta.vmdk file>  <vmdk file> (vmkfstools -i hacssfnp01-000001-delta.vmdk hacssfnp01.vmdk)

ESX version:vmware –v

Esx release: vmware -r

Kernel version: uname –a


/etc/sysconfig/networkà server name, domain prefix, gateway

/etc/sysconfig/network-scripts/ifcfg-vswif0à to change the ip address of the service console

/etc/resolve.confà dns server/name server information

/etc/hostsà info about mapping of ip address to host name

/etc/vmware/esx.conf: this file contains information about the device settings.

/etc/vmware/license.cfg: server-based license file. It has info about the licensing mode, server, features, edition and state.


/etc/vmware/vmware.lic: host-based license file.


cat /proc/scsi/scsi.




lspci: List PCI devices available to the service console or list information about devices connected to PCI system bus

lspci –v List PCI devices in verbose mode.

Lspci | grep –i lpf/qfa

vmkchdev –l

esxcfg-vmhbadevs –q (shows mapping between vmhba names and /dev names)

esxcfg-rescan vmhba1


Esxcfg-info | grep –i lpf/qla

Esxcfg-info | grep –i node_number/port_number

Esxsfg-info | grep –i ”port number”/iqn

Display the current firewall configuration

esxcfg-firewall –q

Identify a list of available services

esxcfg-firewall –s

To obtain a status of a service

esxcfg-firewall –q <servicename>

Services may also be individually enabled or disabled

esxcfg-firewall –e <servicename> (enable)

esxcfg-firewall –d <servicename> (disable)

To open/close a port on the service console

esxcfg-firewall –o <port>,<protocol>, <direction>,<name>  (open)

esxcfg-firewall –c <port>,<protocol>, <direction>  (close)

esxcfg-firewall -o|–openPort <port,tcp|udp,in|out,name>        Opens a port.

esxcfg-firewall -o 383,tcp,in,hpovo

esxcfg-firewall -o 383,tcp,out,hpovo

If you do query, then you can see as follows

hpovo               : port 383 tcp.out

Disabling Firewall on ESX host

esxcfg-firewall –allowIncoming –allowOutgoing.

NOTE: This will disable the firewall built into ESX server. If more secure configuration is required skip this step.


df –ah reports disk space usage per file system

vdf –h reports the vmfs disk usage

du -sh / — reports disk space usage per folder/directory.

less /var/log/vmkernel — views the vmkernel log file.  Most critical operations or errors on the host are logged here.

less /var/log/vmware/hostd.log — views the hostd.log file.  Most virtual machine operations are logged here.

less /var/log/vmware/vpx/vpxa.log — views the vpxa.log file.  Most operations initiated by VirtualCenter are logged here.


tail  -n <x num > –f


for file in $(ls *.vmdk |egrep -v “delta|flat”); do; echo $file; grep CID $file — this displays the CID value and parent CID value for each vmdk header file.  The parent CID value in one delta file should correspond to the CID value in the delta file that preceded it.


Ls –ltr

Cp –rp (preserve permission)

Cp –r source dir destination dir

Rm –r <directory>

Rm –ri <directory>

Rmdir – to remove empty directory


Chmod, chown, chgrp

Creating new user id: useradd <name> –p <password>





vmkload_mod: The program vmkload_mod is used to load device driver and network shaper modules into the VMkernel. vmkload_mod can also be used to unload a module, list the loaded modules and list the available parameters for each module.

[root@haccssvm012 etc]# vmkload_mod –help

Warning: vmkload_mod -e –exportsym

-a –addsym

-b –brief

-u –unload

-l –list

-s –showparam

-k –export-ksyms[=<format>]

-v –verbose <level>

-h –help

-t –generate-trampolines=(stats|pdd)

module [name=value …]

lsmod: List all loaded modules and

insmod: install a loadable module into the running kernel

insmod parport: Install the loadable module named parport into the running kernel.

Dmesg: shows which modules are loaded in kernel space

Dmesg | grep –i lpf/qla

service xinetd stop

service vmware-vpxa stop

service mgmt-vmware stop

ps -ef |grep vmware-hostd

you should see two processes running


kill the 1st process listed. example:  kill -9 1596

repeat this step using ps –ef |grep mgmt-vmware

service vmware-vpxa start

service mgmt-vmware start

service xinetd start


1)service mgmt-vmware stop    (6) service mgmt-vmware start

ps –aux | grep host

kill -9

2)service vmware-vpxa stop       (5)service vmware-vpxa start

3)service  xinetd stop                     (4)service xinetd start


Start-scripts: scripts inside /etc/init.d/

Mgmt-vmware: start/stop/restart the deamon for VI Client connection

Vmware-vpxa: start/stop/restart the deamon for VC connections


Vmware-hostd: demon for VI client connection (running process. Should only be started by mgmt-vmware start-script).


To enable SSH:

The simplest solution is to enable ssh access for root.  This is done by editing file /etc/ssh/sshd_config, change “PermitRootLogin no” to “permitRootLogin yes“; then do “service sshd restart”.

Once that is done, you can use the SCP command to send the files from one ESX host to another using root id.


If you like to give SSH permission to user id other than root.

Create an SSHUser id from the console screen and edit the sshuser file.

open up the sshClient port on your hosts.

esxcfg-firewall -e sshClient

Once the client is open, you can use scp to copy the files using a non-privileged user.


ESX 3.0 has no FTP server installed by default. They completely removed the capability to run an FTP server by default. The option to open “FTP” in the MUI is only for FTP client (i.e, outgoing communication to an FTP server). If you need to use FTP, you will have to download and install an FTP server on the ESX 3.0 Host (NOT a good idea). Best bet is open up the sshClient port on your hosts. They already have the server enabled by default.

Vmware ha detect failures and provides rapid recovery for the vms running within a cluster. Core functionality includes host monitoring & vm monitoring to minimize downtime when heartbeats are lost.

Vmware drs enables vc server to manage hosts as a aggregate pool of resources. Vmware drs also enables vc to mange the assignment of vms to hosts automatically, suggesting placement when vms are powered on, and migrating running vms to balance load and enforce resource allocation policies.

Vmware ha is a reactive reaction system, reacting to host failure. Vmware drs is a procative solution, and gives you better resource utilization for running vms by balancing the cluster.

After a host failure, ha will restart vms and drs will migrate them to balance the workloads.

Requirements for ha: access to shared storage from all hosts (vms must reside on shared storage), access to same vm networks from all hosts, name resolution between all hosts (each host in an ha cluster must be able to resolve the host name and ip address of other hosts in the cluster)

Cluster is a pool/set of hosts.

Memory balloon driver (vmmemctl) is memory allocation technique which allows you to take physical memory from virtual machine x and redistribute it to virtual machine y, possibly forcing virtual machine x to use vswap file.

Balloon driver is loaded into the guest os as a pseudo device driver or kernel service. It has no external interface within guest, and communicates with esx host via a private channel.

Transparent page sharing is memory conservation technique which allows you to eliminate redundant copies of memory pages across virtual machines on the host, i.e, it eliminate duplicate copies of memory pages allocated to multiple virtual machines.

Memory balloon driver and paging from a virtual machine to a server swap file are the two distinct techniques for dynamically expanding or contracting the amount of memory allocated to vm


Core services (basic management services for a virtual datacenter)

1)      task scheduler: scheduler action such as vmotion to happen at a given time.

2)      Host & vm configuration: allows the configuration of host and vms.

3)      Resource and vm inventory management: organizes vms and resources in virtual environment and facilities their management.

4)      Vm provisioning: guides and automates the provisioning of vms.

5)      Alarm & event management: tracks and warns users on potential resources over utilization or event conditions.

6)      Statistics & logging: statistics of datacenter element such as vms, hosts and clusters. Logs and report on the performance and resource utilization

Esx server management services and processes that run in the service console.

Hostd (host deamon): it performs actions in the service console on behalf of the service console and vi client.

Vmauthd: it authenticates remote users of vi client & remote console using user name and password database.

Net-snmpd: it implements snmp traps and data structures that an administrator can use to intergrate an esx server system into a snmp based system management tool



One thought on “Basic commands for VMware

  1. Pingback: “unspecified path” couldn’t power on the machine” | Dream Virtual

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s