Frogg logo

Frogg's web tools

Hand Crafted Tools

Home > VMWare Esxi > Esxi Command
Welcome on Frogg's web tools | Current date :
21/11/2024

Esxi Command

VM Operations

copy to clipboard List of registered VMs (it display the VMid)
vim-cmd vmsvc/getallvms

List of running VM (it display WorldID) copy to clipboard
esxcli vm process list

Stop properly a VM copy to clipboard
esxcli vm process kill -t soft -w <WorldID>

Kill a VM copy to clipboard
esxcli vm process kill -t force -w <WorldID>

Display VM state copy to clipboard
vim-cmd vmsvc/power.getstate <VMid>

Shutdown a VM copy to clipboard
vim-cmd vmsvc/power.off <VMid>

Start a VM copy to clipboard
vim-cmd vmsvc/power.on <VMid>

Restart a VM copy to clipboard
vim-cmd vmsvc/power.reboot <VMid>

Reload a VM configuration (after modification of .vmx file) copy to clipboard
vim-cmd vmsvc/reload <VMid>

Delete all VM snapshot copy to clipboard
vim-cmd vmsvc/snapshot.removeall <VMid>

Estimate size to consolidate Vm snapshot copy to clipboard
vim-cmd vmsvc/get.spaceNeededForConsolidation <VMid>

Register a vm on the host copy to clipboard
vim-cmd solo/registervm /vmfs/volumes/datastore/VM2/VM2.vmx

Unregister a vm on the host copy to clipboard
vim-cmd hostsvc/unregister <VMid>

Display VM summary copy to clipboard
vim-cmd vmsvc/get.summary <VMid>

Virtual Disk operation

Create a virtual disk copy to clipboard
vmkfstools -c 10G /vmfs/volumes/datastore1/VM3/VM3_1.vmdk

Add a virtual disk to an existing VM (in SCSI0:1): copy to clipboard
vim-cmd vmsvc/device.addexisting <VMid> /vmfs/volumes/datastore1/VM3/VM3_1.vmdk 0 1

Add a disk to a VM (like 2 previous command in a row) copy to clipboard
vim-cmd vmsvc/device.diskadd <VMid> 10G 0 1 datastore1

Convert virtual disk from Thin to Thick copy to clipboard
vmkfstools -j /vmfs/volumes/datastore1/VM1/VM1.vmdk

Convert virtual disk from Thick to Thin copy to clipboard
vmkfstools -K /vmfs/volumes/datastore1/VM1/VM1.vmdk

Increase VM disk size copy to clipboard
vmkfstools -X 15G /vmfs/volumes/datastore1/VM1/VM1.vmdk

Rename a disk copy to clipboard
vmkfstools -E OldFileName.vmdk NewFileName.vmdk

Host operation

Reset the whole configuration (like when freshly installed) copy to clipboard
/sbin/firmwareConfig.sh –reset

Add a liscence to the host copy to clipboard
vim-cmd vimsvc/license –set XXXXX-XXXXX-XXXXX-XXXXX-XXXXX

Enable maintenace mode copy to clipboard
vim-cmd hostsvc/maintenance_mode_enter

Disable maintenance mode copy to clipboard
vim-cmd hostsvc/maintenance_mode_exit

Synchronize & save host config (file saved in /scratch/downloads) copy to clipboard
vim-cmd hostsvc/firmware/sync_config
    vim-cmd hostsvc/firmware/backup_config

Restore host config (from /tmp/configBundle.tgz file) copy to clipboard
vim-cmd hostsvc/firmware/restore_config /tmp/configBundle.tgz

Display installed patch list copy to clipboard
esxcli software vib list

Manually install a patch (requier maintenance mode) copy to clipboard
esxcli software vib update –depot=/vmfs/volumes/datastore1/ESXi500-201109001.zip

Allow a service on the firewall copy to clipboard
esxcli network firewall ruleset set -r snmp -e true

Disable firewall copy to clipboard
esxcli network firewall set -e false

Display error list of VMkernel: copy to clipboard
vmkerrcode -l

Display host version copy to clipboard
esxcli system version get

Display advanced paramters copy to clipboard
esxcli system settings advanced list

start DCUI (can be usefull in SSH), Ctrl + C to quit copy to clipboard
dcui

Services Operations

check « hostd » service copy to clipboard
/etc/init.d/hostd status

restart « hostd »: copy to clipboard
/etc/init.d/hostd restart

restart vCenter agent (« vpxa »): copy to clipboard
/etc/init.d/vpxa restart

Restart all services copy to clipboard
services.sh restart

Enable SSH until next reboot copy to clipboard
/etc/init.d/SSH start

Enable SSH copy to clipboard
vim-cmd hostsvc/enable_ssh
    vim-cmd hostsvc/start_ssh

Display all service start on boot copy to clipboard
chkconfig -l

Network Operations

Display physical network list copy to clipboard
esxcli network nic list

Create a vSwitch copy to clipboard
esxcli network vswitch standard add -v vSwitch1

Add a physical interface to a vSwitch copy to clipboard
esxcli network vswitch standard uplink add -u vmnic1 -v vSwitch1

Add a PortGroup to a vSwitch copy to clipboard
esxcli network vswitch standard portgroup add -p LAN -v vSwitch1

Add a physical interface to a PortGroup copy to clipboard
esxcli network vswitch standard portgroup policy failover set -a vmnic0,vmnic1 -p LAN

Define the VLAN for a PortGroup copy to clipboard
esxcli network vswitch standard portgroup set -v 40 -p LAN

Set a VMkernel nterface for a PortGroup copy to clipboard
esxcli network ip interface add -i vmk1 -p NFS

Set an IP for a VMkernel interface copy to clipboard
esxcli network ip interface ipv4 set -i vmk1 -I 10.40.1.1 -N 255.255.255.0 -t static

Enable CDP for a vSwitch copy to clipboard
esxcli network vswitch standard set –cdp-status both -v vSwitch1

Modify the MTU of a VMkernel interface copy to clipboard
esxcli network ip interface set -m 9000 -i vmk1

Modify the MTU of a vSwitch copy to clipboard
esxcli network vswitch set -m 9000 -v vSwitch1

Storage Operation

Display LUNs list copy to clipboard
esxcli storage nmp device list

Display path copy to clipboard
esxcli storage nmp path list

Display LUNs & VMFS links copy to clipboard
esxcli storage filesystem list

Rescan of SAN on all HBAs copy to clipboard
esxcli storage core adapter rescan –all

Or do a Rescan of SAN copy to clipboard
vim-cmd hostsvc/storage/vmfs_rescan

Refresh the LUNs copy to clipboard
vim-cmd hostsvc/storage/vmfs_refresh

Display the list of volumes not shown (cause detected as snaphot) copy to clipboard
esxcli storage vmfs snapshot list

Force to mount a VMFS copy to clipboard
esxcli storage vmfs snapshot mount VMFS1

Resign a VMFS copy to clipboard
esxcli storage vmfs snapshot resignature VMFS2

Display VAAI volumes compatibility copy to clipboard
esxcli storage core device vaai status get

Enable iSCSI software initiateur copy to clipboard
esxcli iscsi software set -e true

iSCSI discovery copy to clipboard
esxcli iscsi adapter discovery rediscover -A vmhba33

Display all NFS volumes mounted: copy to clipboard
esxcli storage nfs list

Add a NFS volume copy to clipboard
esxcli storage nfs add -H {IP} -s {PATH} -v {NFS_Name}

Remove a NFS volume copy to clipboard
esxcli storage nfs remove -v {NFS_Name}

Avoir la liste des VMs allumés avec leur WorldGroupID et leur disques: Display running VMs with them WorldGroupID and disks copy to clipboard
vscsiStats -l

Start to collect stats for a VM (stop automatically after 30 min) copy to clipboard
vscsiStats -w <WorldGroupID> -s

Display an histogram of latency of collected performances copy to clipboard
vscsiStats -w <WorldGroupID> -p latency

Stop stats collect for a VM copy to clipboard
vscsiStats -x <WorldGroupID> -s

Rename a VM

remove it from the inventory
then rename the disk with the command copy to clipboard
vmkfstools -E {OLD}.vmdk {NEW}.vmdk

rename the vmx copy to clipboard
mv "{OLD}.vmx" "{NEW}.vmx"

rename the vmdk copy to clipboard
mv "{OLD}.vmdk" "{NEW}.vmdk"

rename the vmxf copy to clipboard
mv "{OLD}.vmxf" "{NEW}.vmxf"

edit {NEW}.vmx change old values to new {OLD}.vmdk & {OLD}.vmxf
then put it back into inventory

ESXi files

Changer la page par défaut copy to clipboard
/usr/lib/vmware/hostd/docroot/index.html

ESXi Log files

It can be usefull to know where log are stored and what role they have. This table show all logs for Esxi 5.x
filesContent
/var/log/auth.loglogs authentification to shell ESXi (successfull or not)
/var/log/dhclient.logdhcp client log and all linked to it
/var/log/esxupdate.logESXi patch and updates Logs
/var/log/hostd.log« Host management » service logs, VMs & hosk task & events, link between vSphere clients & vCenter agent (vpxa), and the SDk connexions
/var/log/shell.logESXi shell command log
/var/log/sysboot.logVMkernel startup logs and module loading
/var/log/syslog.logservice Management, watchdogs, scheduled task and DCUI logs
/var/log/usb.logusb logs, as found & VMS usb tranfert
/var/log/vob.logVMkernel event viewer , like vob.component.event
/var/log/vmkernel.logVMkernel Core logs, with hardware, storage, network,vm starts and events linked to them
/var/log/vmkwarning.logalert & error summary for the VMKernel
/var/log/vmksummary.logsummary of start/stop sequence, heartbeat, uptime, started VMS, ressources used by services
/var/log/vpxa.logvCenter agent (vpxa) logs, with vCenter Server & « Host Management » (hostd) communication
/var/log/fdm.logHigh Availability module logs, by the service « fdm »

VMWare Tools under Linux

In vSphère > Vm > guest > installer VMWare tools, this will mount WMWare tools in the cd rom

Copy the vmtools copy to clipboard
cp /media/cdrom/VMwareTools-9.2.2-893683.tar.gz /usr/local/src

then go to this folder copy to clipboard
cd /usr/local/src

Uncompress VMWare tools copy to clipboard
tar xzf /usr/local/src/VMwareTools-9.2.2-893683.tar.gz

go to the folder extracted copy to clipboard
cd /usr/local/src/vmware-tools-distrib/

An launch the installation script copy to clipboard
./vmware-install.pl -d

Page created by the 06/04/2022 15:52
Generated in 0.001 sec & displayed in ... sec