VMware Cloud Community
ukCloud9
Contributor
Contributor

get vmdk size without knowing VM

Hi,

I'm new to fourms, so be gentle Smiley Wink

I'm looking for orphaned disk, so thanks to those who have put in scripts to find the vmdk names. Smiley Happy

I'd like to try and find the size of the virtual disk, including all its associated 'sub' files. The datastore size for the 'master' header file, vmdk, seems to always be around 400, with the main data being in the assocated files -flat or RDM

I wonder what the ways of getting this info are? (using ds search with a wider match pattern?, somehow using vmfs tools, get-harddisk without a vm name?)

Thanks for any pointers.

0 Kudos
1 Reply
ctrople
Enthusiast
Enthusiast

Well, there's not an easy way to do this with the PowerCLI yet, but it can be done with some SDK code. The attached chunk of code will identify any *-flat.vmdk files (the meat of the virtual disk) that are not currently registered to a vCenter. It does not list out the other associated files, but it would allow you to get a ballpark idea of how much space orphaned virtual disks are eating up. It could be modified to include all files in the directory if this doesn't get you enough data to figure out where to clean house. This takes a long time to run so you might want to point it at one datastore at a time by editing the Get-Datastore line to include a specific -Name parameter.

======================================

Chyna Trople, VCP

Monitor. Correlate. Act. | vWire.com

======================================

Chyna Trople, VCP Monitor. Correlate. Act. | vWire.com