Thin Provisioning and Storage Capacity on vSphere

24 09 2010

I like thin provisioning on vSphere.  I also like not over-allocating datastores by half a terabyte without knowing it.  To prevent crazy amounts of over-allocation (but still keep the environment going with a slightly-less-crazy amount of over-allocation) it is important for me to know the “true” free space on all of my datastores.  By this, I do not mean what vCenter tells me is the free space, but rather a blend of a couple things: the actual usage on the datastore, and the current allocation on that datastore.  With these, I can determine how far I can push the provisioning of virtual machines before I need to worry about running out of space and DOSing other VMs on the same datastore.

Lucky for me, this data is readily available with the PowerCLI, here’s the source code: Read the rest of this entry »


Storage Rescan/Refresh using the VI Toolkit

26 04 2009

This will rescan all HBAs, VMFS filestores and refresh the storage subsystem for all hosts in a particular cluster:

$myCluster=get-cluster -name “My Cluster Name”

$myHosts=get-vmhost -location $myCluster

foreach ($myHost in $myHosts) { Get-VMhostStorage -vmhost $myHost -rescanallhba -rescanvmfs -refresh }