VMware Cloud Community
CesarTabares
Enthusiast
Enthusiast

Unable to delete VM from disk

I was playing around with a VM I know is not in production anymore, and renamed a VMDK file in the Web client, and downloaded and uploaded a modified vmx file to the only datastore this VM has files in.

Sadly now when I want to delete it permanently, I get this error:

Failed to delete the virtual machine, '/vmfs/volumes/53222532-8a77d33b-4c45-b8ca3a69ef34/vsvsdtls001/vsvsdtls001.vmx'.

Unable to load configuration file '/vmfs/volumes/53222532-8a77d33b-4c45-b8ca3a69ef34/vsvsdtls001/vsvsdtls001.vmx'.

The virtual machine configuration is invalid.

Failed to delete the virtual machine, '/vmfs/volumes/53222532-8a77d33b-4c45-b8ca3a69ef34/vsvsdtls001/vsvsdtls001.vmx'.

The Hard Disk also disappeared from the Summary view, where it also says "There is no network assigned to this virtual machine", and there's no normal menu under Actions anymore for that VM, to delete or migrate or edit settings. So I've made a mess, and I would like to get some help from you guys to get rid of this problem Smiley Happy

I'm sure this is fixable, I just don't know exactly how. Do I have to edit the VMX file? Probably not in a text editor like I've tried here...

Reply
0 Kudos
7 Replies
vHaridas
Expert
Expert

Try to Unregister/remove VM from inventory.

Then if you want to remove VM and vmdk files permanently then browse datastore, find that specific VM folder and delete that VM folder and tis files.

Thanks,

Haridas

Virtual Admin

Please consider awarding points for "Correct" or "Helpful" replies. Thanks....!!! https://vprhlabs.blogspot.in/
Reply
0 Kudos
CesarTabares
Enthusiast
Enthusiast

Sounded like a good and easy plan, but the Action menu does not allow me to do that, this is what it looks like

Capture.PNG

I'm gonna have to use another method to delete it permanently. I found this article, do you think I should try that?

VMware KB: Deleting an orphaned virtual machine when the Remove option is not available

Reply
0 Kudos
LucianoPatrão

Hi,

First you should never edit a vmx. Particularly if you dont know how it woks, and what type of changes is possible to make, and how. This will came to a VM unconfigured and will not work.

Now you could try to remove/add the VM from the inventory, but I pretty sure that you not work.

So you need to browse you datastore(using vSphere Client tool) then go to the folder where is the VM and right mouse in the vmx file and add VM to inventory.

Hope this helps.

Luciano Patrão

VCP-DCV, VCAP-DCV Design 2023, VCP-Cloud 2023
vExpert vSAN, NSX, Cloud Provider, Veeam Vanguard
Solutions Architect - Tech Lead for VMware / Virtual Backups

________________________________
If helpful Please award points
Thank You
Blog: https://www.provirtualzone.com | Twitter: @Luciano_PT
Reply
0 Kudos
CesarTabares
Enthusiast
Enthusiast

I saw just now that the name of the VM now includes (orphaned) at the end.

Capture.PNG

Proceed with the step JailBreak suggested, adding VM to inventory? It seems added already to me, since I see it in my list of virtual machines

NB: JailBreak I cannot remove the VM from the inventory, as mentioned earlier

Reply
0 Kudos
LucianoPatrão

Hi,

Just do all manually in the ssh console: VMware KB: Registering or adding a virtual machine to the Inventory in vCenter Server or in an ESX/E...

Before you could do anything, removed it first. Then try to add and then delete from disk.

Luciano Patrão

VCP-DCV, VCAP-DCV Design 2023, VCP-Cloud 2023
vExpert vSAN, NSX, Cloud Provider, Veeam Vanguard
Solutions Architect - Tech Lead for VMware / Virtual Backups

________________________________
If helpful Please award points
Thank You
Blog: https://www.provirtualzone.com | Twitter: @Luciano_PT
Reply
0 Kudos
CesarTabares
Enthusiast
Enthusiast

Let me see if I got this right, because I want to be careful and not break anything

1. Register the VM in the Webclient/SSH console

2. Delete the VM from disk once it has been registered

Comments from the documentation:

If an ESX host is being managed by vCenter Server, perform any virtual machine registration through vCenter Server.

Note: Bypassing vCenter Server to register a virtual machine may cause a mismatch between the host and the vCenter Server Inventory and may cause unexpected results.

Question:

Does "Orphaned" in the name, mean that is it not registered in the inventory?

I probably should try to register it though the Web client first right? I feel uncomfortable with SSH, never done anything there before

Reply
0 Kudos
LucianoPatrão

Hi,

Orphaned VMs are VMs that were somehow unregister and the process did not finish properly. So vCenter have a VM without a register, but have records of it. The process was not finish and did not clean all the process.

If you cannot use vSphere Client(web or not) to do the unregister, register and then delete, then you need to do it manually. The VM is lost anyway, so there is no issues doing that manually.

Luciano Patrão

VCP-DCV, VCAP-DCV Design 2023, VCP-Cloud 2023
vExpert vSAN, NSX, Cloud Provider, Veeam Vanguard
Solutions Architect - Tech Lead for VMware / Virtual Backups

________________________________
If helpful Please award points
Thank You
Blog: https://www.provirtualzone.com | Twitter: @Luciano_PT
Reply
0 Kudos