baber
Expert
Expert

How can find the VMDK's owner

I have a vmdk file but don't know which vm is using from this VMDK file . How can understand which virtual machine is using from this VMDK file or I can remove it ?

BR

Please mark helpful or correct if my answer resolved your issue.
15 Replies
IRIX201110141
Champion
Champion

IIRC RVtools have a "health" tab on the most right and list "Zombie" VMDKs which are not referrenced. Same for VMs which are not in the Inventory.

Otherwise you have to scan (grep) each *.vmx on very Host/Datastore.

If a VMDK is in use than you can query with vmkfstool which Host holds the lock. You cant remove a -flat.vmdk which is in use but you can remote the describtor i think.

Regards,
Joerg

0 Kudos
baber
Expert
Expert

Is that possible try to remove xx-flat.vmdk ? if this is using canot delete it . is that correct ?

Please mark helpful or correct if my answer resolved your issue.
0 Kudos
Nawals
Expert
Expert

Hi,

You have to check the VMs disk from VM properties. Right click on VM and click "Edit settings" and you can see all the VMDKs are using by that VMs. Don't delete the xx-flat.vmdk  as you can loose the VM.

If VM is locked you have to find the VM on which datastore residing. then run command #vmkfstools -D </vmfs/volumes/VMname/VM.vmx or xxx.vmdk> to see which host locked the VM.

NKS Please Mark Helpful/correct if my answer resolve your query.
0 Kudos
baber
Expert
Expert

Thanks. but as I previously said I just have a vmdk file with name a.VMDK and a-flat.vmdk and there is not any vm with this name in my inventory. I think the vm's name has renamed and thee are many vm in the environment,

now want to know how can find out which vm is using from this vmdk file ?

the command is not useful return follow output:

[root@host13:/vmfs/volumes/5e3d185a-f3a1e080-8c0e-d06726b7acd0/testicdb] vmkfstools -D /vmfs/volumes/LUN-Low-2/a/a.vmdk

Lock [type 10c00001 offset 322248704 v 85, hb offset 3604480

gen 23549, mode 0, owner 00000000-00000000-0000-000000000000 mtime 43080130

num 0 gblnum 0 gblgen 0 gblbrk 0]

Addr <4, 25, 1>, gen 3, links 1, type reg, flags 0, uid 0, gid 0, mode 600

len 450, nb 0 tbz 0, cow 0, newSinceEpoch 0, zla 4305, bs 65536

affinityFD <4,24,1>, parentFD <4,24,1>, tbzGranularityShift 20, numLFB 0

lastSFBClusterNum 0, numPreAllocBlocks 0, numPointerBlocks 0

BR

Please mark helpful or correct if my answer resolved your issue.
0 Kudos
Nawals
Expert
Expert

OK. It look like zombie vmdk which is not in used. Before going to delete must verified. you need to manually verify if have few vms. If have more VMs then use RVtool to see the report. share the screenshot of those VMs if you are ok else rvtool report is fine. shared the out put that said VM is not locked by any host.

NKS Please Mark Helpful/correct if my answer resolve your query.
0 Kudos
baber
Expert
Expert

According to the output , how did you understand the vmdk is lock or not?

Please mark helpful or correct if my answer resolved your issue.
0 Kudos
IRIX201110141
Champion
Champion

Because of the owner 0....0....0. Normaly you see the MAC of the Host there. But thats not 100% bulletproof.

Again.... this vmdk can be assign to a VM which is shutdown and there for sure there is no lock.

Again..... search for a.vmdk by using grep in every *.vmx.

0 Kudos
Nawals
Expert
Expert

Mode 0 means not locked by any host. If Mode 1 you can see the MAC address of host.

NKS Please Mark Helpful/correct if my answer resolve your query.
0 Kudos
baber
Expert
Expert

As I have more than 300 vms thus there are very vmx files and as you said some of them are power.off now you said had to search in vmx file to see where is vmdk file using . Would you say how can do that in my datacenter ?

Please mark helpful or correct if my answer resolved your issue.
0 Kudos
baber
Expert
Expert

Thanks. this is the output for other vm that I now is using and just mode changed to 1 but cannot find out which hosts or vm is using that

Lock [type 10c00001 offset 426213376 v 70, hb offset 3473408

gen 64511, mode 1, owner 5f1818d1-cba711f6-4389-d06726b7a6e8 mtime 6091031

num 0 gblnum 0 gblgen 0 gblbrk 0]

Addr <4, 39, 12>, gen 29, links 1, type reg, flags 0x2, uid 0, gid 0, mode 600

len 53687091200, nb 51200 tbz 0, cow 0, newSinceEpoch 51200, zla 3, bs 1048576

affinityFD <4,52,0>, parentFD <4,52,0>, tbzGranularityShift 20, numLFB 100

lastSFBClusterNum 0, numPreAllocBlocks 0, numPointerBlocks 7

Please mark helpful or correct if my answer resolved your issue.
0 Kudos
Nawals
Expert
Expert

The owner 5f1818d1-cba711f6-4389-d06726b7a6e8 indicates that the MAC address of the ESXi/ESX host locking the file is d0:67:26:b7:a6:e8

Now you can check the above MAC address and move the vm on that host which will release the locked.

NKS Please Mark Helpful/correct if my answer resolve your query.
baber
Expert
Expert

Thanks but according that . this will be useful just vm is power.on while the vm is power.off  because if the vm is power.off certainly the mode will be show =0 . Is there any solution to understand the owners of the VMDK file if the machine ispower.off.

Please mark helpful or correct if my answer resolved your issue.
0 Kudos
IRIX201110141
Champion
Champion

grep can work recursive. Writing a powershell script crawl through your complete datacenter. The one and only way it to check the vDisk filename and compare.

Did you check RVtools?

Regards,

Joerg

0 Kudos
baber
Expert
Expert

According to RVtools it detected Zambie . but it detects few other vms as zaombie . How can it detect which vm is zambie ?

Please mark helpful or correct if my answer resolved your issue.
0 Kudos
scott28tt
VMware Employee
VMware Employee

This thread might help: How to find Orphaned VMDK files


-------------------------------------------------------------------------------------------------------------------------------------------------------------

Although I am a VMware employee I contribute to VMware Communities voluntarily (ie. not in any official capacity)
VMware Training & Certification blog
0 Kudos