Removing the ESXi host from the Distributed Virtual Switch fails with the error: 'The resource 1 is in use'
search cancel

Removing the ESXi host from the Distributed Virtual Switch fails with the error: 'The resource 1 is in use'

book

Article ID: 439384

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

When attempting to migrate/remove an ESXi host between Datacenters or Clusters within the same vCenter environment, administrators may encounter several blockers:

  • The migration fails with an error stating the "The resource '1' is in use" preventing the host from being removed from a Distributed Virtual Switch (DVS).
    Operation failed!
    Task name: Reconfigure vSphere Distributed Switch
    cluster-vds01
    The resource '1' is in use.
  • Attempts to unmount or detach legacy datastores via the vSphere HTML5 Client fail because the "Detach" option is greyed out or missing.

Environment

VMware vCenter Server 8.x
VMware vCenter Server 7.x

Cause

These blockers are typically caused by:

  1. The management VMkernel (vmk0) remains bound to the Distributed Switch, and standard UI migration tasks cannot break this association while the host is active in the inventory.
  2. Background host processes, such as vSphere HA (vmware-fdm) or Storage I/O Control (storageRM), retain active locks on storage volumes.

Resolution

NOTE: The following steps involve completely removing the host from the vCenter inventory and resetting its configuration. This procedure is not applicable for hosts participating in a vSAN/NSX cluster, as resetting the configuration or removing the host incorrectly can lead to data availability issues or vSAN object errors.

Phase 1: Clear Network Locks 

  1. Place the ESXi host into Maintenance Mode.
  2. Disconnect and Remove the host from the vCenter inventory.
  3. Access the host's physical console or IPMI/iDRAC/ILO and enter the Direct Console User Interface (DCUI).
  4. Select Reset System ConfigurationNote: This will reset all local host configurations, including passwords and networking, but will not impact data on persistent datastores.
  5. Reconfigure the Management Network (IP, Subnet, Gateway) via the DCUI to match the requirements of the new Datacenter.
  6. Add the host back into the new Datacenter/Cluster in vCenter.

Phase 2: Clear Storage Locks,  If datastores remain mounted and the "Detach" option is greyed out:

  1. Log in to the ESXi host via SSH.
  2. Stop the services holding silent locks:
    • /etc/init.d/vmware-fdm stop
    • /etc/init.d/storageRM stop
  3. Run the below command to identify Datastore names mapped to NAA_ID.
    • esxcli storage vmfs extent list

       

  4. Unmount the filesystem via CLI:
    • esxcli storage filesystem unmount -l <Datastore_Label>
  5. To detach the device:
    • esxcli storage core device set --state=off -d <NAA_ID>
  6. Clean up the detached device list:
    • esxcli storage core device detached remove -d <NAA_ID>
  7. Rescan storage adapters to refresh the UI:
    • esxcli storage core adapter rescan --all