ESXi

 View Only
Expand all | Collapse all

Cannot delete VM v7 inside ESXi 4 local VMFS

  • 1.  Cannot delete VM v7 inside ESXi 4 local VMFS

    Posted Sep 07, 2009 04:29 AM

    Hi All,

    I've got a broken VM which was failed to start, it is Windows Vista VM which i couldn't bring it back online again after it suspended itself, I did services.sh restart command and I was able to delete from the Disk

    but then i still could not delete the remaining files in the directory ?

    there are two files namely:

    WindowsVista_Ex-e346672a.vswp

    WindowsVista_Ex-flat.vmdk

    i cannot delete it from the datastore browser or even kill it from the SSH console as follows:

    ~ # ps | grep Ex

    5862144 vmm0:WindowsVista_Ex

    5911300 5837567 Worker#0:WindowsVista_Ex /bin/vmx

    ~ # kill -9 5862144

    ash: cannot kill pid 5862144: No such process

    ~ # kill -9 5911300

    ash: cannot kill pid 5911300: No such process

    ~ # kill -9 5837567

    ash: cannot kill pid 5837567: No such process

    ~ # esxtop

    ~ # kill -9 3426065

    ash: cannot kill pid 3426065: No such process

    my last resort is to format the Datastore in this case.

    any kind of suggestion would be greatly appreciated.

    thanks.

    Kind Regards,

    AWT



  • 2.  RE: Cannot delete VM v7 inside ESXi 4 local VMFS

    Posted Sep 07, 2009 05:14 AM

    You can try to release the pending lock with vmkfstools command.

    See the example with a single file on this page:

    http://www.vmware.com/support/esx21/doc/esx21admin_vmvkfstools.html

    Andre



  • 3.  RE: Cannot delete VM v7 inside ESXi 4 local VMFS

    Posted Sep 07, 2009 05:42 AM

    Hi Andre,

    thanks for the reply, i should execute

    vmkfstools -L(confused of which one shall i pick) /vmfs/devices.disks

    would that be ok running that script on the live host during the business hours ?

    otherwise the last think that i shall try is to VMotion all VM into the other storage and format it.

    Kind Regards,

    AWT



  • 4.  RE: Cannot delete VM v7 inside ESXi 4 local VMFS

    Posted Sep 07, 2009 09:04 AM

    Use this command:

    vmfkstools -L release /vmfs/devices/disks/...

    Maybe not in business our :smileywink:

    Andre



  • 5.  RE: Cannot delete VM v7 inside ESXi 4 local VMFS

    Posted Sep 30, 2009 05:36 AM

    Well, i finally VMotion-ed all of the VM and then performing the ESXi host restart, by then i can formatted the local SATA datastore.

    Kind Regards,

    AWT



  • 6.  RE: Cannot delete VM v7 inside ESXi 4 local VMFS

    Posted Sep 07, 2009 05:18 AM

    If you move to datastore using ssh are you able to delete the two files using rm ?

    Obviousy using ssh ...

    Riccardo Riva

    VCP,RHCE,FCNSA

    If you found this or other information useful, please consider awarding points for "Correct" or "Helpful". Thank You!



  • 7.  RE: Cannot delete VM v7 inside ESXi 4 local VMFS

    Posted Sep 07, 2009 05:45 AM

    Hi Riva,

    I couldn't delete it from the SSH console either :-|

    /vmfs/volumes/4a361632-ac906f2d-ef98-001ec9f0c733 # ls

    WindowsVista_Ex

    /vmfs/volumes/4a361632-ac906f2d-ef98-001ec9f0c733 # rm -rf WindowsVista_Ex/

    rm: cannot remove 'WindowsVista_Ex/WindowsVista_Ex-e346672a.vswp': Device or resource busy

    rm: cannot remove 'WindowsVista_Ex/WindowsVista_Ex-flat.vmdk': Device or resource busy

    rm: cannot remove 'WindowsVista_Ex': Directory not empty

    /vmfs/volumes/4a361632-ac906f2d-ef98-001ec9f0c733 #

    Kind Regards,

    AWT



  • 8.  RE: Cannot delete VM v7 inside ESXi 4 local VMFS

    Posted Sep 07, 2009 09:53 AM

    Occasionally virtual machines (VMs) get stuck in a zombie state and will not respond to a power-off command using the traditional vSphere client power controls. Rebooting a host will fix this condition — but rebooting is usually not an option. Fortunately, there are a few methods for forcing the VM to shut down without rebooting the host.

    The methods below are listed in order of usage preference starting with using normal VM commands and ending with a brute force method.

    Method 1 - Using the vmware-cmd service console command (the command-line interface equivalent of using the vSphere Client)

    1. Log in to the ESX service console.

    2. The vmware-cmd command uses the configuration file name (.vmx) of the VM to specify the VM to perform an operation on. You can type vmware-cmd -l to get a list of all VMs on the host and the path and name of their configuration file. The path uses the Universally Unique Identifier (UUID) or long name of the data store; alternatively, you can use the friendly name instead. If you do not want to type the path when using the vmware-cmd command you can change to the VM’s directory and run the command without the path.

    3. You can optionally check the power state of the VM by typing vmware-cmd <VM config file path & name> getstate.

    4. To forcibly shutdown a VM type vmware-cmd <VM config file path & name> stop hard.

    5. You can check the state again to see if it worked; if it did the state should now be off.

    Method 2 - Using the vm-support command to shut down the VM by first finding the virtual machine ID

    …and then using the vm-support command to forcibly terminate it. This method does a lot more then shutting down the VM, as it also produces debugging information that you can use to troubleshoot an unresponsive VM.

    1. Log in to the ESX Service Console.

    2. The vm-support command is a multi-purpose command that is mainly used to troubleshoot host and VM problems. You can use the -X parameter to forcibly shutdown a VM and also produce a file with debugging information. This command will create a .tgz file in the directory that you run it in and cannot be run from a VMFS volume directory (running it in the /tmp directory is recommended). First type vm-support -x to get a list of the virtual machine IDs (VMID) of your running VMs.

    3. To forcibly shut down the VM and generate core dumps and log files, type vm-support -X <VMID>. You will receive prompts asking if you want to take a screenshot of the VM. A screenshot can be useful to see if there are any error messages. You will also be prompted to see if you wish to send an NMI and an ABORT to the VM, which can aid in debugging. You must say yes to the ABORT prompt for the VM to be forcibly stopped. Once the process completes, which can take 10-15 minutes, a .tgz file will be created in the directory in which you ran the command that you can also use for troubleshooting purposes. To avoid filling up your file system when the file is created, switch to the /tmp directory when you run the command.

    4. You can check the state of the VM again either by using the vmware-cmd command or by typing vm-support -x and you should not see the VMID for that VM listed anymore. Be sure and delete the .tgz file that is created when you are done to avoid filling up your host disk.

    Method 3 - Using the kill command by first finding the process identifier (PID) of the VM and then using the kill command.

    1. Log in to the ESX service console.

    2. The process status (ps) command in Linux shows the currently running processes on a server and the grep command finds the specified text in the output of the ps command. Type ps auxfww | grep <virtualmachinename> to get the process ID (PID) of the VM. You will have two entries returned, one is from the running of the ps command. The longer entry is the running VM process. The longer entry will end in the config file name of the VM and is the one you want to use; the number in the second column of that entry is the PID of the VM.

    3. The kill command in Linux sends a signal to terminate a process using its ID number. The ‘-9′ parameter forces the process to quit immediately and cannot be ignored like the more graceful ‘-15′ parameter can sometimes be. Type kill -9 <PID> which will forcibly terminate the process for the specified VM.

    4. You can check the state using the vmware-cmd command to see if it worked; if it did, the state should now be off.

    All three of these methods work identically on ESX hosts in both VI3 and vSphere. These methods also work for ESXi, but their execution is a bit different. In a future blog post we will cover how to use these methods with ESXi.



  • 9.  RE: Cannot delete VM v7 inside ESXi 4 local VMFS

    Posted Sep 09, 2009 11:19 PM

    Unfortunately trying to remove the Datastore (delete and then add + reformat) is also not going well.

    Remove datastore

    *The resource vim.host.DatastoreSystem ESXi01-localVMFS is in use.*_

    rebooting the host at the moment is not an option as i have to schedule it in quite long time as there re 32 VMs running from the SAN through this host.

    Kind Regards,

    AWT



  • 10.  RE: Cannot delete VM v7 inside ESXi 4 local VMFS
    Best Answer

    Posted Sep 24, 2009 05:45 PM

    I had the same situation. This is what i did. I brought the system host in maintainace mode. Then deleted the vm in datastore and exit the maintance mode.



  • 11.  RE: Cannot delete VM v7 inside ESXi 4 local VMFS

    Posted Nov 29, 2009 11:38 AM

    Wow, thanks for the trick Luigi.

    Kind Regards,

    AWT



  • 12.  RE: Cannot delete VM v7 inside ESXi 4 local VMFS

    Posted Nov 29, 2009 08:59 PM

    Hoped it worked for you also. Glad i can help.

    Best Regards

    Luigi