Force shutdown or kill a stuck VMWare virtual machine

Sometimes when a LUN is full a VM cannot shutdown properly

  • Make a SSH connection to the host where the VM running at
  • Login as root
  • list all running VM’s
# vmware-cmd -l
  • Get the current state
# vmware-cmd /vmfs/volumes/<UUID>/<VMDIR>/<VMNAME>.vmx getstate
  • Output:
[root@esx ~]# vmware-cmd /vmfs/volumes/<UUID>/<VMDIR>/<VMNAME>.vmx getstate
getstate() = stuck
  • Now you know for sure the status is stuck you can kill the VM
ps auxwww |grep -i <VMNAME>.vmx</span>
  • Output:
root 3093 0.0 0.3 2016 860 ? S< Jul30 0:17 /usr/lib/vmware/bin/vmkload_app /usr/lib/vmware/bin/vmware-vmx -ssched.group=host/user -# name=VMware ESX Server;version=3.5.0;licensename=VMware ESX Server;licenseversion=2.0 build-158874; -@ pipe=/tmp/vmhsdaemon-0/vmx569228e44baf49d1; /vmfs/volumes/49392e30-162037d0-17c6-001f29e9abec/<VMDIR>/<VMNAME>.vmx
  • The code right after root is the PID you must kill.
  • First try only kill
#kill 3093
  • Wait 30 seconds and try a getstate again:
# vmware-cmd /vmfs/volumes/<UUID>/<VMDIR>/<VMNAME>.vmx getstate
  • If the state is “off” your ready. If the state is still stuck try the following:
#kill -9 3093
  • Wait 30 seconds and see the state is “off” now.

If the state is still “stuck” migrate all VM’s to another host en reboot the host.

When the VM is off by the kill command HA (High Availability) will power on the host automaticly. Now power down the server during the boot trough the VMWare GUI. If the VM is off try to remove snapshots, (re) move disks, or fix the thing who cause the crash.

Source: VMware KB 1004340


	

VMware ‚ÄúCannot open the disk ‚ÄėXXXXXX.vmdk‚Äô or one of the snapshot disks it depends on.‚ÄĚ

Source: http://www.ardamis.com/2009/11/20/vmware-cannot-open-the-disk-xxxxxx-vmdk-or-one-of-the-snapshot-disks-it-depends-on/

From time to time, I want to copy just the minimum files for a VMware virtual machine: the two .vmdk files and the .vmx file. After moving those files to a new location or deleting a snapshot file, attempting to boot the virtual machine returns the following error message:

Cannot open the disk ‚ÄėXXXXXX.vmdk‚Äô or one of the snapshot disks it depends on.
Reason: The system cannot find the file specified.

I’ve found that following the steps below fixes the problem and allows me to boot the virtual machine as it existed at the time of creation. DO NOT USE these steps if you need to retain any changes to the machine:

Open the *.vmx file in a text editor and find the line that refers to the old snapshot file, which will look something like:
scsi0:0.fileName = ‚ÄúXXXXXX-000002.vmdk‚ÄĚ
or
ide0:0.fileName = ‚ÄúXXXXXX-000002.vmdk‚ÄĚ

Change the value to the filename of the ~1kb .vmdk file (which happens to be the same as the name of the VM). For example, if your virtual machine was named ‚ÄúWindows XP Professional‚ÄĚ, the line would read:

scsi0:0.fileName = ‚ÄúWindows XP Professional.vmdk‚ÄĚ

Power on the VM. It should boot normally, but because the snapshot file is missing, the machine will boot to an earlier state.

Configure Jumbo Frames in esx 4 Vsphere

Jumbo Frames !!!!!!

-> Lets understand what‚Äôs Jumbo Frames first and how it benefits us …¬†

  • Jumbo frames are Ethernet frames with more than 1,500 bytes of payload (MTU). Conventionally, jumbo frames can carry up to 9,000 bytes of payload.
  • Jumbo Frames allow ESX Server to send larger frames out onto the physical network. The network must support Jumbo Frames end‚Äźto‚Äźend for Jumbo Frames to be effective.
  • iSCSI with jumbo frames gives better or rather much better performance .If you are getting sluggish performance then try enabling jumbo frames¬†

So let’s activate it, I have used Jumbo frames only with SW initiator not HW one so if some can comment on how it works on HW it would be in for a great benefit.

Most probably you might have your VMkernel setup with 1500 MTU so we need to delete it and start over again. Its¬†recommend¬†to start from 0 but if you wish you can enable the jumbo frames on the fly, it won’t throw any errors.

In my case vSwitch1 was used as VMkernel for iscsi.

Step  1:
[root@esx sysconfig]# esxcfg-vswitch -d vSwitch1
Step 2:

Then I went ahead and did a listing

[root@esx sysconfig]# esxcfg-vswitch -l
Switch Name    Num Ports   Used Ports  Configured Ports  MTU     Uplinks
vSwitch0       32          3           32                9000    vmnic0

PortGroup Name      VLAN ID  Used Ports  Uplinks
VM Network          0        0           vmnic0
Service Console     0        1           vmnic0

As it can be seen no VMkernel

Then lets start the stuff ………

Step 3:

Add a vSwitch

[root@esx sysconfig]#  esxcfg-vswitch -a vSwitch1

Step 4:

List it….
[root@esx sysconfig]#  esxcfg-vswitch -l
Switch Name    Num Ports   Used Ports  Configured Ports  MTU     Uplinks
vSwitch0       32          3           32                9000    vmnic0
PortGroup Name      VLAN ID  Used Ports  Uplinks
VM Network          0        0           vmnic0
Service Console     0        1           vmnic0
Switch Name    Num Ports   Used Ports  Configured Ports  MTU     Uplinks
vSwitch1       64          1           64                1500
PortGroup Name      VLAN ID  Used Ports  Uplinks

Step 5:
Lets set the jumbo frames AKA MTU

If you wish you can execute the below command on the fly to your vSwitch without deleting it
[root@esx sysconfig]# esxcfg-vswitch -m 9000 vSwitch1
List it to see the diference
[root@esx sysconfig]#  esxcfg-vswitch -l
Switch Name    Num Ports   Used Ports  Configured Ports  MTU     Uplinks
vSwitch0       32          3           32                9000    vmnic0
PortGroup Name      VLAN ID  Used Ports  Uplinks
VM Network          0        0           vmnic0
Service Console     0        1           vmnic0
Switch Name    Num Ports   Used Ports  Configured Ports  MTU     Uplinks
vSwitch1       64          1           64                9000
PortGroup Name      VLAN ID  Used Ports  Uplinks
As it can be seen MTU is now 9000 not 1500

Step 6 :
Lets assign a NIC to the newly created vSwitch
[root@esx sysconfig]# esxcfg-vswitch -L vmnic1 vSwitch1
The result
[root@esx sysconfig]# esxcfg-vswitch –l
Switch Name    Num Ports   Used Ports  Configured Ports  MTU     Uplinks
vSwitch0       32          3           32                9000    vmnic0
PortGroup Name      VLAN ID  Used Ports  Uplinks
VM Network          0        0           vmnic0
Service Console     0        1           vmnic0
Switch Name    Num Ports   Used Ports  Configured Ports  MTU     Uplinks
vSwitch1       64          2           64                9000    vmnic1
PortGroup Name      VLAN ID  Used Ports  Uplinks
Step 7:
Lets give it a port group
[root@esx sysconfig]#  esxcfg-vswitch -A VMkernel vSwitch1
Step 8:

Lets see Whether we got desired output
[root@esx sysconfig]#  esxcfg-vswitch -l
Switch Name    Num Ports   Used Ports  Configured Ports  MTU     Uplinks
vSwitch0       32          3           32                9000    vmnic0
PortGroup Name      VLAN ID  Used Ports  Uplinks
VM Network          0        0           vmnic0
Service Console     0        1           vmnic0
Switch Name    Num Ports   Used Ports  Configured Ports  MTU     Uplinks
vSwitch1       64          2           64                9000    vmnic1
PortGroup Name      VLAN ID  Used Ports  Uplinks
VMkernel            0        0           vmnic1
Step 9:

Now lets give it IP
[root@esx sysconfig]#  esxcfg-vmknic -a -i 192.168.0.11 -n 255.255.255.0 -m 9000 VMkernel
Hmm the output is ……..
[root@esx sysconfig]#  esxcfg-vswitch -l
Switch Name    Num Ports   Used Ports  Configured Ports  MTU     Uplinks
vSwitch0       32          3           32                9000    vmnic0
PortGroup Name      VLAN ID  Used Ports  Uplinks
VM Network          0        0           vmnic0
Service Console     0        1           vmnic0
Switch Name    Num Ports   Used Ports  Configured Ports  MTU     Uplinks
vSwitch1       64          3           64                9000    vmnic1
PortGroup Name      VLAN ID  Used Ports  Uplinks
VMkernel            0        1           vmnic1
Property of vmknic
[root@esx sysconfig]#  esxcfg-vmknic -l
Interface  Port Group/DVPort   IP Family IP Address                              Netmask         Broadcast       MAC Address       MTU     TSO MSS   Enabled Type
vmk0       VMkernel            IPv4      192.168.0.11                            255.255.255.0   192.168.0.255   00:XX:83:91:23:14 9000    65535     true    STATIC

Source: http://moizzy.blogspot.com/2010/02/configure-jumbo-frames-in-esx-4-for.html