esxcfg-mpath -l
o obtain LUN multipathing information from the ESX/ESXi host command line:
Log in to the ESX host console.
Type esxcfg-mpath -b to list all devices with their corresponding paths:
The command esxcli nmp device list lists of LUN multipathing information:
To change the multipath policy information from the ESX/ESXi host command line:
Log in to the ESX/ESXi host.
Run the command:
esxcli nmp -d <naa_id> <path_policy>
where <naa_id> is the NAA ID of the device and <path_policy> is one of the PSP options listed above.
For example, to change the above device path policy to Round Robin:
esxcli nmp -d naa.6006016010202a0080b3b8a4cc56e011 VMW_PSP_RR
To enable or disable a path from the ESX/ESXi host command line:
Log in to the ESX/ESXi host.
Run the command:
esxcfg-mpath -P=<path> -s=<state>
Where:
<path> is the particular path to be enabled/disabled
<device> is the NAA ID of the device
<state> is active or off
proc/scsi/qlaxxx/1
[root@esx
~]# esxcfg-rescan vmhba2
*Error:
Unable to scan adapters for VMFS*
I get the following from vmkfstools
--root@esx ~--# vmkfstools -V
Failed scanning adapter 'vmfs-only' : Address temporarily unmapped
Error: Opaque service console status
This workaround is available only in update 1, and changes what the vmkernel does when it detects this APD state for a
storage device, basically just immediately failing to open a datastore volume if the device’s state is APD. Since it’s
an advanced parameter change – I wouldn’t make this change unless instructed by VMware support.
esxcfg-advcfg -s 1 /VMFS3/FailVolumeOpenIfAPD
Some QnA:
Q: Does this happen if you’re using PowerPath/VE?
A: I’m not sure – but I don’t THINK that this bug would occur for devices owned by PowerPath/VE (since it replaces the
bulk of the NMP stack in those cases) – but I need to validate that. This highlights to me at least how important
these little things (in this case path state detection) are in entire storage stack.
In any case, thought people would find it useful to know about this, and it is a bug being tracked for resolution.
Hope it helps one customer!
f virtual machines are not responding on an ESX/ESXi 4.0 host, determine if an all-paths-down condition exists, by
executing:
esxcfg-mpath --list-paths --device <device naa> | grep state
or
esxcfg-mpath --list-paths --device <device mpx> | grep state
where:
<device naa> is the Network Addressing Authority (NAA) unique address for the full storage device
<device mpx> is the identifier if a NAA ID is not available
o enable this option, execute:
esxcfg-advcfg -s 1 /VMFS3/FailVolumeOpenIfAPD
To disable and reset to the default value without requiring downtime, execute:
esxcfg-advcfg -s 0 /VMFS3/FailVolumeOpenIfAPD
To check the value of this option, execute:
esxcfg-advcfg -g /VMFS3/FailVolumeOpenIfAPD
#esxcfg-scsidevs -l
#esxcfg-scsidevs -l
Other commands
NETWORKING
esxcfg-vmknic
esxcfg-route
esxcfg-firewall
esxcfg-vswif
esxcfg-vswitch
esxcfg-nics
STORAGE
esxcfg-dumppart
esxcfg-mpath
esxcfg-nas
esxcfg-swiscsi
esxcfg-vmhbadevs
Service Console Administration
esxcfg-info
esxcfg-advcfg
esxcfg-resgrp
switchesDisplay current configurations:
•# esxcfg-vswitch-l
Detach a physical NIC from a virtual switch:
•# esxcfg-vswitch–U <pnic> <vSwitch_name>
Link a physical NIC to a virtual switch:
•# esxcfg-vswitch–L <pnic> <vSwitch_name>
VMware SysInfo
esxcfg-info –a | more
How to Use vmware-cmd command
Login to ESX Server using ssh client and enter vmware-cmd command it displays the syntax of the full command.
How to get the list of VM’s from ESX Console
Syntax: vmware-cmd –l ( l – list)
Ex : vmware-cmd -l
Note: It displays the complete path of the VM and .vmx file details.
/vmfs/volumes/4abb234abasdk2h34/vm20031/vm20031.vmx
/vmfs/volumes/4abb234abasdk2h34/vm20032/vm20032.vmx
/vmfs/volumes/4abb234abasdk2h34/vm20033/vm20033.vmx
How to get the Status of VM from ESX Console
Syntax: vmware-cmd (path & .vmx file) getstate
Ex: vmware-cmd /vmfs/volumes/4abb234abasdk2h34/vm20031/vm20031.vmx getstate
How to power on VM from ESX Console
Syntax : vmware-cmd (path & .vmx file) start
Ex: vmware-cmd /vmfs/volumes/4abb234abasdk2h34/vm20031/vm20031.vmx start
How to PowerOff VM from ESX Console
Syntax : vmware-cmd (path & .vmx file) stop
Ex: vmware-cmd /vmfs/volumes/4abb234abasdk2h34/vm20031/vm20031.vmx stop
How to Power On VM from ESX Console
Syntax : vmware-cmd (path & .vmx file) start
Ex: vmware-cmd /vmfs/volumes/4abb234abasdk2h34/vm20031/vm20031.vmx start
How to Suspend VM from ESX Console
Syntax : vmware-cmd (path & .vmx file) suspend
Ex: vmware-cmd /vmfs/volumes/4abb234abasdk2h34/vm20031/vm20031.vmx suspend
How to reset VM from ESX Console
Syntax : vmware-cmd (path & .vmx file) reset
Ex: vmware-cmd /vmfs/volumes/4abb234abasdk2h34/vm20031/vm20031.vmx reset
How to register VM from ESX Console
Syntax : vmware-cmd -s register (path & .vmx file)
Ex: vmware-cmd -s register /vmfs/volumes/4abb234abasdk2h34/vm20031/vm20031.vmx
How to Unregister VM from ESX Console
Syntax : vmware-cmd -s unregister (path & .vmx file)
Ex: vmware-cmd -s unregister /vmfs/volumes/4abb234abasdk2h34/vm20031/vm20031.vmx
How to get the VM ID from ESX Console
Syntax : vmware-cmd (path & .vmx file) getid
Ex: vmware-cmd /vmfs/volumes/4abb234abasdk2h34/vm20031/vm20031.vmx getid
How to get the Process ID for VM from ESX Console
Syntax : vmware-cmd (path & .vmx file) getpid
Ex: vmware-cmd /vmfs/volumes/4abb234abasdk2h34/vm20031/vm20031.vmx getpid
How to get Connections information for VM from ESX Console
Syntax: vmware-cmd (path & .vmx file) getremoteconnections
Ex: vmware-cmd /vmfs/volumes/4abb234abdk2h34/vm20031/vm20031.vmx getremoteconnections
List all storage devices:
$ /usr/sbin/esxcfg-scsidevs -c
List LUNs, paths & multipathing plugins:
$ /usr/sbin/esxcfg-mpath –L
List HBA and it’s WWN
#esxcfg-mpath -l
List all VMware SATPs:
$ /usr/sbin/esxcli nmp satp list
List claim rules:
$/usr/sbin/esxcli corestorage claimrule list
Test VMkernel connectivity: $ /usr/sbin/vmkping
Manage HW iSCSI (Qlogic) settings:
$/usr/sbin/esxcfg-hwiscsi –l
Manage SW iSCSI settings:
$ /usr/sbin/esxcfg-swiscsi -q
List iSCSI LUNs:
$ /usr/sbin/vmkiscsi-tool –L –l adapter
Rescan iSCSI LUNs:
$ /usr/sbin/esxcfg-rescan adapter
#esxcfg-rescan vmhba32
#vmkfstools –s vmhba1
List the NFS exports from the VMkernel:
$ /usr/sbin/esxcfg-nas –l
To extend vmdk
#vmkfstools –x 20GB /vmfs/vol/storage1/vm.vmdk
V2V
Extpart.exe
Diskpart.exe
ADD VM IN THE INVENTORY
#vmware-cmd –s register /vmfs/volumes/4…/printer/printer.vmx
To see the kernel info
#/etc/issue
To change the network setting
#/etc/sysconfig/network
To see registered Vm’s
#/etc/vmware/vm-list
Display free space
#vdf
To get PID
#cat /proc/vmware/vm/*/names | grep vmname
To kill the VM
- ps auxfwww | grep <vmname>
- Kill 9 PID
Or # ps –ef | grep vm_name.vmx
#kill -9 <PID_number>
To increase swap size
Find the location which have enough free space
#df –h
#su –
#dd if=/dev/zero of=/extraswap bs=1M count=512
#mkswap /extraswap
#swapon -s
[ dd command is used to create imagefile of partitions or the whole disk]
rwx permissions
change the permission of the file / folder
trace the user activity
#less filename <<< page by page
Commands
#esxcfg- vswif –l
#esxcfg-vswitch –l
#esxcfg-nics –l
To Add Vswitch
#esxcfg-vswitch –a vswitch1
To link NIC with vswitch
# esxcfg-vswitch –L vmnic1 vswitch1
#esxcfg-route –l
#esxcfg-vmknic <options>
-a = add -r = restore –l= list –d=delete –h=help –i=IP -e=enable –D=disable –n=network
$ sudo /usr/sbin/esxcfg-scsidevs -c
List LUNs, paths & multipathing plugins:
$ sudo /usr/sbin/esxcfg-mpath –L
List HBA and it’s WWN
#esxcfg-mpath -a
List all VMware SATPs:
$ sudo /usr/sbin/esxcli nmp satp list
List claim rules:
$ sudo /usr/sbin/esxcli corestorage claimrule list
Lists datastores, dev names to VMFS:
$ sudo /usr/sbin/esxcfg-scsidevs -m
List snapshot volumes:
$ sudo /usr/sbin/esxcfg-volume -l
Test VMkernel connectivity: $ /usr/sbin/vmkping
Manage HW iSCSI (Qlogic) settings:
$ sudo /usr/sbin/esxcfg-hwiscsi –l
Manage SW iSCSI settings:
$ sudo /usr/sbin/esxcfg-swiscsi q
List iSCSI LUNs:
$ sudo /usr/sbin/vmkiscsitool –L –l adapter
Rescan iSCSI LUNs:
$ sudo /usr/sbin/esxcfg-rescan adapter
#esxcfg-rescan vmhba32
#vmfstools –s vmhba1
List the NFS exports from the VMkernel:
$ sudo /usr/sbin/esxcfg-nas –l
# Df
#vdf –h shows vmfs volumes and devices also shows
vmkernal status return code display utility
#/usr/sbin/vmkerrorcode -l
Show isci process pid
#/usr/sbin/vmkiscsid
To test iscsi- it should pass all test
#/usr/sbin/vmkiscsi-test
To load or unload vmkernal
#/usr/sbin/vmkloader - options
To load or display vmkernal modules
#/usr/sbin/vmkload_mod
To set vmware esx hardware management
#/usr/sbin/vmkmicrocodeintel
To see hwclock, lsof, pid , vmware version, swap etc
#/usr/sbin/vmkvsitools
To see uptime run this script
#/usr/sbin/vmkuptime.pl
To see memory, io, cpu, system info
#/usr/sbin/vmstat
To take snap of all vm on esx
#/usr/sbin/vmsnap_all in old ver now use vcbsnap_all
VM Restore command
#/usr/sbin/vmres.pl in old version now use vcbrestore
To genereate complete esx server report
#/usr/sbin/vm-support
To check vmware version and update
#/usr/sbin/vmware -v -l
#/usr/sbin/vmware-authd
#/usr/sbin/vmware-autopoweron
Commands for server operations, vm operations like start, stop, getstate,
uptime, and more commands for vm etc with option
#/usr/sbin/vmware-cmd
VM inventory matching with /etc/vmware/configrules
#/usr/sbin/vmware-configcheck
change the shell prompt to shell
#/usr/sbin/vmware-vimsh
#/usr/sbin/vmware-vim-cmd
#/usr/sbin/vmware-hostd
#/usr/sbin/vmware-hostd-support
#/usr/sbin/vmware-vimdump
shows watchdog is running or not
#/usr/sbin/vmware-watchdog
#/usr/sbin/vmware-webAccess
To switch off the virtual machine using the command line option:
1. Log on to the ESX host server using an SSH console utility, such as PUTTY.
2. Type the following command and press Enter.
#vmware-cmd <.vmx file Path > stop
For example, vmware-cmd /vmfs/volumes/l3esx35\:storage1/l3-2003-ldap/l3-2003-ldap.vmx stop
Where, l3-2003-ldap.vmx is the virtual machine configuration file name that is stored in /vmfs/volumes/l3esx35\:storage1/l3-2003-
ldap/
folder of the virtual machine.
It is recommended that you kill all the processes running on the virtual machine if it freezes. Complete the following steps for an
ESX 3.x
host:
1. List all the running virtual machines to identify the VMID of the virtual machine.
# cat /proc/vmware/vm/*/names
To capture a snapshot using the command line option:
1. Start Xterm or the terminal console.
2. Run the following command.
# vmware-cmd /<.vmx Path of the Image > createsnapshot <Snapshot name>
For example, #vmware-cmd /vmfs/volumes/l3esx35\:storage1/l3-2003-ldap/l3-2003-ldap.vmx
createsnapshot
Base image
To register the virtual machine using the command line.
Access the ESX Host server from the SSH Console or Putty Client.
Switch to the Root user.
Run the following command.
#vmware-cmd –s register <.vmx file Path >
To unregister the virtual machine using the command line.
Access the ESX Host server from the SSH Console or Putty Client.
Switch to the Root user.
Run the following command.
#vmware-cmd –s unregister <.vmx file Path >