Skip to content

To Thin Provision? Get it Right the First Time

Let’s face it, space is money and we are always looking for a way to save it.  Thin provising help you do just that if you plan your deployments . Giving a thin provisioned hard drive can expand on demand and consume all data on the datastore if you over allocate the space.  In that event, the datastore can remain full and not allow the running vm’s to write to the datastore causing major issues.   You will have to free up space in order to get the VM’s running again.  Freeing up space can be a task in itself, and this can take some time and when a server is completely down.  I will show you how to setup some alarms to help keep this from happening later.  So I am going to help you show you a few tips that should get you going in the right directions. The below script can give you a birds eye view of what servers would benefit the most from thin provisioning.   First you need to run a powercli script that will give a little more depth on how your environment looks.  I found this great script on virtual insanity’s website.

Copy the contents of this script and put it in a notepad document.  And remember to make the changes in red to your vCenter server.   Place the document under the C:\ so you are able to find the document with ease.

# Set the Filename for the exported data
$Filename = “C:\VMDisks.csv”

Connect-VIServer MYVIServer

$AllVMs = Get-View -ViewType VirtualMachine
$SortedVMs = $AllVMs | Select *, @{N=”NumDisks”;E={@($_.Guest.Disk.Length)}} | Sort NumDisks -Descending

$VMDisks = @()
ForEach ($VM in $SortedVMs){
$Details = New-object PSObject
$Details | Add-Member -Name Name -Value $ -Membertype NoteProperty
$DiskNum = 0
Foreach ($disk in $VM.Guest.Disk){
$Details | Add-Member -Name “Disk$($DiskNum)path” -MemberType NoteProperty -Value $Disk.DiskPath
$Details | Add-Member -Name “Disk$($DiskNum)Capacity(MB)” -MemberType NoteProperty -Value ([math]::Round($disk.Capacity/ 1MB))
$Details | Add-Member -Name “Disk$($DiskNum)FreeSpace(MB)” -MemberType NoteProperty -Value ([math]::Round($disk.FreeSpace / 1MB))
$VMDisks += $Details
Remove-Variable Details
$VMDisks | Export-Csv -NoTypeInformation $Filename

Now use PowerCLI to generate this report and it will stick the output under your C:\.  The excel spreadsheet will list all of your virtual disks on each and every vm that you have in that environment.  Keep in mind that is only the size of the hard drives and not relative to how much free space you have on the datastore.  Obviously you wouldn’t want to use dynamic storage provisioning in every scenario, but I guarantee you will want to utilize it one fashion or another.    From this Excel sheet you should start making notes on what servers could benefit from thin provisioning.   Along with noting servers, make sure you allocate enough space on the datastore for a buffer as well.   I try to make sure I have at least 10% free space in all the VMFS datastores at it’s fullest.  If you leave that buffer, then you will have plenty of room for snapshots for the VM’s.

Next we need to set up some alarms so we can be alerted when we are running out of space.   We can use the walk through that LucD has on his website to generate these scripts.  As you can see from this site, you can set this up with a script or use vCenter to manually create them.  You can set these up to send you an email, or just create warnings in vCenter.  I would create these warnings before I implemented an thin provisioning.

Here are some other great sites to look through when you are doing some research on thin provisioning.

Posted in CLI, Datastores, vCenter.

Tagged with , , , , .

No Responses (yet)

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Some HTML is OK

or, reply to this post via trackback.