Finding thin-provisioned virtual disks with PowerShell

By default, all virtual hard disks in VI3 are thick disks — space is allocated on the VMFS datastore for the entire disk.  Thin disks, on the other hand, grow dynamically according to guest OS demand.  There is a slight performance penalty with thin disks, but the real risk when using them is inadvertently filling up datastores after overcommitting storage resources.

The VI Client interface will not let administrators create new virtual machines with thin-provisioned disks.  Even so, it is entirely possible that your environment contains such disks.  Let’s take a look at a couple of ways to create these disks and then use a VI Toolkit (for Windows) PowerShell script to see if any exist.

Manual VMDK Creation

One way that thin disks may be introduced into an environment is by manually creating a VMDK file and then attaching that file to a virtual machine.  This can be accomplished by the vmkfstools command with the -d thin option.  This procedure is not for beginners, so if you have used it you presumably evaluated the risks of overcommitting your storage.  But what if one of your colleagues did this without telling you?

Compact Clones

VI Client - Clone to templateAnother source of thin disks requires a little background first:

There is a prominent option in the VI Client interface to convert a virtual machine to template (and vice versa).  But if you right-click a VM in the inventory, you are presented with a variation of that feature:  Clone to Template.

The wizard that launches in response to that option allows an administrator to optionally choose the Compact disk format — this is a thin-provisioned disk.  If your template has a 50GB virtual disk but only 8GB are actually used, this feature can provide significant storage savings.

Clone to Template Wizard - Compact disk

So far so good.  Now, what do you suppose happens if you decide to convert that template to a VM?  Nothing happens — it just works.  You are free to use that VM just like any other in your inventory.  But this VM keeps its thin-provisioned disk, a fact that is not discernible through the user interface.

Find the Thin-Provisioned Disks

I wrote a small VI Toolkit (for Windows) PowerShell script that identifies latent thin disks in both VMs and templates.  I hope you find it useful:

Thin-provisioning is a great tool to have in your toolbox, when used properly.

Script inspired by this thread.

Tags: , , , , , , ,

3 comments

  1. Sven Huisman’s avatar

    Nice Powershell script. Here is a nice addition to your blogpost:
    http://virtualfuture.info/2008/12/vmware-esx-35-and-thinprovisioning/

  2. Eric Gray’s avatar

    Sven, thank you for the link — good info on thin disks.

Comments are now closed.