VMware

This Question is Answered

2 "helpful" answers available (6 pts)
2 Replies Last post: Jan 30, 2009 2:57 AM by utarion  

How to determine if a disk is Thin posted: Jan 30, 2009 2:08 AM

Click to view utarion's profile Novice 10 posts since
Dec 15, 2008

I have a quick query. I am trying to determine using Powershell if a Disk is thin provisioned or not. Is there a way programmatically to determine this? I was using the following but it does not provide me with what I want.

$fileQueryFlags = New-Object VMware.Vim.FileQueryFlags
$fileQueryFlags.FileType = $true
$fileQueryFlags.FileSize = $true
$fileQueryFlags.Modification = $true

Thanks


Re: How to determine if a disk is Thin

1. Jan 30, 2009 2:35 AM in response to: utarion
Click to view LucD's profile Champion 2,431 posts since
Oct 31, 2005
That info is available in the VirtualDiskFlatVer2BackingInfo object in the thinProvisioned property.
The following script scans through all your VMs and all their devices and will list any thin provisioned disks.
Get-VM | Get-View | % {
	Write-Host $_.Name
	foreach($dev in $vm.config.hardware.Device){
		if($dev.GetType().Name -eq "VirtualDisk"){
			if($dev.Backing.ThinProvisioned){
				Write-Host "`t" $dev.DeviceInfo.Label "ThinProvisioned"
			} 
		}
	}
}

VMware Developer

SDKs, APIs, Videos, Learn and much more in the Developer community.

Learn More

Developer Sample Code

Increase your developer productivity with VMware API sample code.

Learn More

VMworld Sessions & Labs

Online access to the latest VMworld Sessions & Labs and online services.

Learn more

Purchase PSO Credits Online

Purchase credits to redeem training and consulting services online.

Buy Now

Community Hardware Software

View reported configurations or report your own.

Learn More

VMware vSphere

Come witness the next giant leap in virtualization.

Register Today

Communities