Device or resource busy/ file is locked error when making changes to a file on an ESXi datastore
search cancel

Device or resource busy/ file is locked error when making changes to a file on an ESXi datastore


Article ID: 323140


Updated On:


VMware vSphere ESXi


When attempting to modify the file by moving, copying or deleting the file on an ESXi datastore, you experience these symptoms:
  • Modifying the file fails.
  • You see this error similar to:

    device or resource busy


    file is locked


VMware vSphere ESXi 8.0
VMware vSphere ESXi 6.0
VMware ESXi 4.0.x Embedded
VMware ESX 4.0.x
VMware ESX Server 3.0.x
VMware vSphere ESXi 5.1
VMware vSphere ESXi 5.0
VMware vSphere ESXi 6.7
VMware ESXi 4.0.x Installable
VMware vSphere ESXi 7.0.0
VMware ESXi 3.5.x Installable
VMware ESXi 4.1.x Embedded
VMware vSphere ESXi 6.5
VMware vSphere ESXi 5.5
VMware ESXi 4.1.x Installable
VMware ESX 4.1.x
VMware ESX Server 3.5.x
VMware ESXi 3.5.x Embedded


This issue occurs as the file is locked or is being used by another process or task.


You can receive this error when the file you are making changes to is locked by another process or task. When the other process is identified , you must wait for the process to complete or stop it.

Warning: Stopping storage related processes abruptly may lead to data corruption.

Note: VMware recommends to validate the file locks. For more information, see Investigating virtual machine file locks on ESXi hosts (10051).

To identify processes that are locking the files:
  1. Open an SSH session to the ESXi host and log in as the root user.
  2. Run this command:

    vmkfstools -D path


    where the path is the full path to the file you are attempting to make changes.
  3. You can also see the output of the above on the logs: For ESXi hosts, run this command:

    tail /var/log/vmkernel.log
  4. Record the MAC address in the output of the vmkfstools command.

    For example:

    vmkernel: 11:04:31:50.251 cpu1:1035)FS3: 130: <START New Virtual Machine-flat.vmdk>
    vmkernel: 11:04:31:50.251 cpu1:1035)Lock [type 10c00001 offset 60088320 v 160, hb offset 3646464
    vmkernel: gen 80, mode 1, owner 604931b4-e9227831-df99-00505601300e mtime 532684]
    vmkernel: 11:04:31:50.251 cpu1:1035)Addr <4, 130, 156>, gen 157, links 1, type reg, flags 0x0, uid 0, gid 0, mode 100600
    vmkernel: 11:04:31:50.251 cpu1:1035)len 16106127360, nb 15360 tbz 0, zla 3, bs 1048576
    vmkernel: 11:04:31:50.251 cpu1:1035)FS3: 132: <END New Virtual Machine-flat.vmdk>

    Note: The MAC address 00:50:56:01:30:0e is represented as 00505601300e.

  5. Determine which host has created the lock by comparing the MAC address from the output of the vmkfstools command with the MAC address from the management interface of all other ESXi hosts:

    a. On the vSphere Client, select the host and click the Configure tab > Networking > VMkernel adapter > Select the vmkernel with a Management tag > Properties > NIC Settings.

    b. You can also get this information with the esxcfg-vmknic -l command.
  6. To verify if an existing NIC has the lock use (Check the MAC addresses of the NICS), run this command:

    esxcli network nic list  or # esxcfg-nics -l
  7. Run this command to verify that there are no virtual machines that could be using the file you are trying to modify.
    find -H /vmfs/volumes/*/*/*.vmx -print0 | xargs -0 grep "filename"

    Note: In ESXi, remove the "-H" option. By doing so, you would get two lines for every resulting vmx. One with the Datastore easy name and another with the Datastore UUID.
  8. Run this command to verify that there are no service console processes accessing the file:

    lsof | grep -i filename
  9. Verify that all processes accessing the file complete or are stopped.
    If these steps do not identify the process that has locked the file, reboot your host or virtual machine.

    Warning: Rebooting a host during a storage operation may result in data loss.

    Note: If a .vmdk file is locked due to a disk remaining hot-added to a backup appliance or backup proxy VM, such a lock will typically persist after host reboot. (For example: If the backup appliance/proxy VM is migrated to another host prior to host reboot, or if the VM is restarted). Confirm that no active backup job is in progress on the VM disk and manually remove the hot-added .vmdk from the backup appliance/proxy VM. See Unable to consolidate VMware virtual machine snapshots due to file lock (2151402)

Additional Information