VMware

How to identify VMs using VMDK files?

I am looking at an issue with datastore space, and when I look, I can see a number of VMDKs that don’t match the server names in vSphere. Not unusual. But how can I confirm that a VMDK is not in use before I delete it?


View Reddit by WhiskyEchoTangoView Source

Related Articles

7 Comments

  1. First easy check is to use ls -la to see when file has been updated. If the time is recent there is a good chance that the vmdk is still in use. If not vm is powered down or the vmdk is not used.

  2. RVtools make short work of this. If the vHealth tab lists it as zombie, then it’s not attached to anything in that vCenter. Use the vDisks tab to see if it is attached to something.

  3. If a vm is powered on, VMware will not let it delete the vmdk or any other file related to that VM because they will be locked. The issue with deleting that way is that maybe a vm is off but you still need it. Testing renaming the vmdk will give you a hint and not be destructive.

    Rvtools will show you zombie vmdks.

    If you have the space, you can also svmotions vms around to get their files to match up with their names.

    I forget if there is a pcli command to reverse map. You can definitely do a command to get all active harddisk mappings.

    get-vm | get-harddisk

    This will show you all vms and their disks but you’d need to cross reference to the vmdk that you see on the datastore.

  4. If someone creates a vm with the name “COMP2”, all the vmdks will be named “comp2.vmdk”. However, if the vm is renamed at the vsphere level to “SPACE5” and doesn’t perform a storage vmotion, then the SPACE5 vm vmdks will still be named comp2.vmdk

Leave a Reply

Your email address will not be published. Required fields are marked *

Close