Trying to retire storage and an esxi host won't release the drive
search cancel

Trying to retire storage and an esxi host won't release the drive

book

Article ID: 416522

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

  • A user is attempting to migrate from old storage to new storage and is unable to unmount the old datastore. The process fails because one or more virtual machines, specifically the vCenter Server Appliance, still appear to be using the datastore.

  • When attempting to disconnect the CD/DVD drive from the VM settings within vCenter, the UI may become unresponsive or the action may not complete successfully. The CD/DVD drive for the affected VM shows as "Connected" and is pointing to an ISO file on the datastore that needs to be unmounted.

Cause

  • The root cause is that the virtual machine's CD/DVD drive is actively connected to an ISO file located on the datastore you are trying to unmount. VMware's hypervisor places a lock on any file that is in use by a running VM. A connected virtual CD/DVD drive is considered "in use," which locks the ISO file and, by extension, prevents the entire datastore from being unmounted.

  • In some cases, particularly with Linux-based appliances like the VCSA, the operating system may automatically mount the virtual CD drive upon boot, reinforcing the lock and making it difficult to release from the vCenter level. Additionally, other VMs on the datastore may have active snapshots that need to be consolidated before they can be fully moved or before the datastore can be released.

Resolution

The recommended solution is to force the disconnection of the virtual CD/DVD drive by logging directly into the ESXi host where the VM is running. This bypasses potential communication issues with vCenter and allows for a direct override of the device lock.

Step-by-Step Instructions

  1. In the vCenter client, identify the specific VM  that is preventing the datastore from being unmounted.

  2. Select the VM and on its Summary tab, identify the ESXi host it is currently running on.

  3. Open a web browser and log in directly to the web interface of that ESXi host.

  4. Navigate to the Virtual Machines section and select the problematic VM.

  5. Click Actions and select Edit settings.

  6. In the "Edit settings" window, find the CD/DVD drive.

  7. Uncheck the Connected checkbox next to the CD/DVD drive.

  8. If a warning appears about overriding a lock, confirm the action by selecting an option similar to "Disconnect anyway and override the lock."

  9. Click Save.

  10. For any other VMs that may be preventing the unmount, check for and delete any unnecessary snapshots. Wait for the "Consolidate virtual machine disk files" task to complete.

  11. After confirming all VMs have released their connections to the old datastore, you can proceed to unmount it from vCenter.