VMware {code} Community
tos2k
Expert
Expert

Detect disk space usage (from within VM)

Hi!

Having VMware-tools installed on a VM, it is possible to detect "used disk space" (GuestInfo ...) via MOB.

Is there any way to find out which virtual disk a partition resides on via MOB, as GuestInfo contains used disk space per partition but I want to summarize per virtual disk?

thx, Tos2k

Reply
0 Kudos
7 Replies
StefanPahrmann

Hi,

http://www.run-virtual.com/?page_id=145 has an example how to accomplish exectly what you want. You can look inside the code and transform it to your own needs.

/Stefan

tos2k
Expert
Expert

This is what I knew already, thx anyway. The difference is that the script maps free diskspace from partitions to the whole VM. But I am missing a link between partitions and (virtual) disks. This not used/shown in the example unfortunately...

"controllerKey" exists for virtual disks, but is missing for guest partitions - I think this should be implemented by VmWare

Tos2k

Reply
0 Kudos
StefanPahrmann

You're right, you can't accomplish that with the SDK.

GuestDiskInfo only provides the 2 properties capacity and freeSpace (which is used on the whole vmdk-file).

http://pubs.vmware.com/vi301/sdk/ReferenceGuide/vim.vm.GuestInfo.DiskInfo.html

Reply
0 Kudos
tos2k
Expert
Expert

If some of the VMware responsible (forum admins) please could reply if this (missing feature) will be implemented? When?

thx, Tos2k

Reply
0 Kudos
jrackliffe
Hot Shot
Hot Shot

You can add my name to the list for a VI SDK process to link the logical GuestInfo.disk instances to their respective physical VirtualDisk, but I am guessing that won't happen overnight.

This is a long shot, but quick question what OS are you trying to do this on?

Wonder if through some non-trivial scripting you could use existing WBEM based interfaces to map the LogicalDisk back to a guest level PhysicalDisk, than take the guest level disk SCSI info and be able to map that into useful data for getting the specific virtual devices back in VI.

Seems like you should be able to do this via WMI for Windows platforms, not sure about non-Win wbem providers.

Don't have any code for you, but maybe it might help.

J

Reply
0 Kudos
tos2k
Expert
Expert

Hi!

Thanx for your reply, but I did not help me much further. I was trying to get this work for both linux and windows machines.

What I am missing is the controller key, that exists for virtual disks, but not for GuestInfo.disk

Why? Is it possible to get the referenced scsi device for a given GuestInfo.disk?

Tos2k

Reply
0 Kudos
jrackliffe
Hot Shot
Hot Shot

Well there are often WBEM providers for Linux that offer CIM objects that may be able to provide you the data you need. I don't know which flavor you are running so I can't speak to what solutions are available, but there may be a pack for using openwbem for your distro.

I am unaware of a way to associate back Guest inventory provided by the Tools and the VM hardware info you need solely through VI.

You may also be able to use data gathered from an Inventory solution you may be running for your Guests and make an educated guess at linking that data to the VirtualDisks.

Good luck.

J

Reply
0 Kudos