Delete content library fails with error "Cannot delete file"
book
Article ID: 411332
calendar_today
Updated On:
Products
VMware vCenter Server
Issue/Introduction
Getting error in vSphere Client when deleting a content library: Cannot delete file [Datastore_name]/<Content_library_file_name>
Error observed while using rm command to delete files in the datastore directory: Device or resource busy
Environment
VMware vCenter Server
Cause
This issue occurs when the ISO file is being mounted and used by other VMs.
Resolution
This issue can be resolved by identifying the virtual machine that holds the ISO and unmounting it.
In the datastore directory, run following command to identify the virtual machine holding the ISO
Use vim-cmd command
Command to identify the list of running VMs and its VMid vim-cmd vmsvc/getallvms
Command to identify if specific ISO being on identified VM using VMid vim-cmd vmsvc/device.getdevices <vmid> | grep -A 12 "<ISO_Image_file_name.iso" | grep "connected = true" Note: Replace <vmid> with the output from last command.
Repeat for all VMid
Use find command to identify the virtual machine find /vmfs/volumes/ -iname "*.vmx" -print0 | xargs -0 grep -ih iso
Procedure to unmount ISO from vCenter UI
Log in to the vSphere Client
Navigate to host and cluster > select the VM
Right-click on a VM and select "Edit Settings".
Under "CD/DVD Drive" tab and check the "Label" and "ISO Path" to see if a specific ISO is mounted.
Deselect the radio button beside "Connected" to unmount the CD/DVD drive.