Cannot delete .vmdk file

Posted on 2008-11-17
Last Modified: 2012-06-27
Even after running "service mgmt-vmware restart" on all the esx hosts, I am still unable to delete the virtual disk file. The original machine has been destroyed and am trying to free up space by deleting this file from the data store. There were no snapshots of this volume. Trying to avoid restarting the entire host.
Question by:bmonroe44
    1 Comment
    LVL 4

    Accepted Solution

    Sometimes a file or set of files in a VMFS become locked and any attempts to edit them or delete will give a device or resource busy error, even though the vm associated with the files is not running. If the vm is running then you would need to stop the vm to manipulate the files. If you know that the vm is stopped then you need to find the ESX server that has the files locked and then stop the process that is locking the file(s).

    1. Logon to the ESX host where the VM was last known to be running.
    2. vmkfstools -D /vmfs/volumes/path/to/file to dump information on the file into /var/log/vmkernel
    3. less /var/log/vmkernel and scroll to the bottom, you will see output like below:
    a. Nov 29 15:49:17 vm22 vmkernel: 2:00:15:18.435 cpu6:1038)FS3: 130:
    b. Nov 29 15:49:17 vm22 vmkernel: 2:00:15:18.435 cpu6:1038)Lock [type 10c00001 offset 30439424 v 21, hb offset 4154368
    c. Nov 29 15:49:17 vm22 vmkernel: gen 66493, mode 1, owner 46c60a7c-94813bcf-4273-0017a44c7727 mtime 8781867] ß Bold type added to number for emphasis.
    d. Nov 29 15:49:17 vm22 vmkernel: 2:00:15:18.435 cpu6:1038)Addr <4, 588, 7>, gen 20, links 1, type reg, flags 0x0, uid 0, gid 0, mode 644
    e. Nov 29 15:49:17 vm22 vmkernel: 2:00:15:18.435 cpu6:1038)len 23973, nb 1 tbz 0, zla 2, bs 65536
    f. Nov 29 15:49:17 vm22 vmkernel: 2:00:15:18.435 cpu6:1038)FS3: 132:
    4. The owner of the lock is on line 3c, the last part is all you need, in this case 0017a44c7727
    5. esxcfg-info | grep -i 'system uuid' | awk -F '-' '{print $NF}' will display the system uuid of the esx server. You need to run the esxcfg-info command on each esx server in the cluster to discover the owner.
    6. When you find the ESX server that matches the uuid owner, logon to that ESX server and run the command: ps -elf|grep vmname where vmname is the problem vm. Example output below:
    a. 4 S root 7570 1 0 65 -10 - 435 schedu Nov27 ? 00:00:02 /usr/lib/vmware/bin/vmkload_app /usr/lib/vmware/bin/vmware-vmx -@ pipe=/tmp/vmhsdaemon-0/vmxf7fb85ef5d8b3522;vm=f7fb85ef5d8b3522 /vmfs/volumes/470e25b6-37016b37-a2b3-001b78bedd4c/iu-lsps-vstest/iu-lsps-vstest.vmx0
    7. Since there is a process running, pid 7570 in the example, you need to kill it by following steps 5-12 on stopping a VM above
    8. Once the kill is complete the files should be released.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    I have recently deployed a VMware View 4.6 virtual desktop infrastructure and the last part of the project was to install the Security Server for remote users to access a virtual desktop from outside of the network. The server installation was st…
    The original payload size or maximum transmission unit (MTU) of an ethernet frame is 1500 bytes. A jumbo frame has an ethernet frame size of 9000 bytes or over. Common Jumbo Frame sizes are 9000, 9216 bytes (example - HP switches). Enabling Jumb…
    Teach the user how to install ESXi 5.5 and configure the management network System Requirements: ESXi Installation:  Management Network Configuration: Management Network Testing:
    This Micro Tutorial steps you through the configuration steps to configure your ESXi host Management Network settings and test the management network, ensure the host is recognized by the DNS Server, configure a new password, and the troubleshooting…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now