S
S
sn00pik2015-09-03 10:12:38
VMware
sn00pik, 2015-09-03 10:12:38

How to determine which VM owns a .vmdk in vSphere 5?

Good afternoon colleagues

Tell me if there is a third-party application for vSphere 5 that can show the link between the .vmdk disk and the VM that uses it.
I ran into a problem - a large number of VMs were deleted, but their vmdks were not deleted, and now they take up space on the datastore, how to identify them as unused?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mureevms, 2015-09-03
@mureevms

I have not heard of such software, it usually works with virtual machines that are available from vSphere and does not look directly at the storage.
Here are a couple of solutions for you:
1. View the file's last modification date from the datastore viewport. Yes, you will either have to manually browse through all the directories.
2. ... or in the console search for files that have not changed, for example, in the last month:

cd /vmfs/volumes/STORAGE_NAME
 find -mtime +30 | grep .vmdk

CAREFULLY!!! this will delete all files older than 30 days.
cd /vmfs/volumes/STORAGE_NAME
 find -mtime +30 -exec rm -i {} \;

3. Parse all .vmx files to match the strings of the virtual machine name and the disk file, then see what corresponds to what:
cd /vmfs/volumes/STORAGE_NAME
egrep "displayName|vmdk" ./*/*.vmx

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question