WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Resources
    • Nested Virtualization
  • VMware Nostalgia
  • Apple
You are here: Home / Uncategorized / How to Query VM Disk Format in vSphere 5

How to Query VM Disk Format in vSphere 5

09.25.2011 by William Lam // 5 Comments

Prior to vSphere 5, it was not trivial to identify the particular disk format for a given virtual machine's disk. Using the vSphere Client, you would see a virtual machine's disk be displayed as either thin or thick. The problem with this is that the "thick" format can be either:

  • zeroedthick - A thick disk has all space allocated at creation time and the space is zeroed on demand as the space is used
  • eagerzeroedthick - An eager zeroed thick disk has all space allocated and wiped clean of any previous contents on the physical media at creation time. Such disks may take longer time during creation compared to other disk formats.

Users would not be able to distinguish the exact type using the vSphere Client or the vSphere 4 APIs. With the release of vSphere 4, VMware did introduce a new property in the vSphere 4 API called eagerlyScrub which was supposed to help identify whether a virtual disk was allocated as an eagerzeroedthick disk. Unfortunately there may have been a bug with the property as it never gets modified whether a disk is created as zeroedthick or eagerzeroedthick.

The only method that I was aware of to truly figuring out the disk format would be to manually parse the virtual machine's vmware.log file to identify the disk type which I wrote a script for in 2009.

During the vSphere 5 beta, I had noticed the vSphere Client UI now properly displays all three virtual machine disk format: zeroedthick (displayed as flat), thin and eagerzeroedthick (displayed as thick).

Seeing that VMware now displays the three different formats, I wanted to see if it was possible to extract this using the vSphere 5 APIs and not have to rely on the hack of reading the vmware.log files. It turns out that the eagerlyScrub property is now functioning properly when a VMDK is provisioned or has been inflated/converted to the eagerzeroedthick format. I wrote a simple vSphere SDK for Perl script called getVMDiskFormat.pl which allows you to extract the disk formats of all virtual machines connecting to either vCenter or directly to an ESX(i) host.

The script allows for two types of output: console (directly on the console) or csv (creates .csv file)

If you select csv output, by default it will be stored in a file called "vmDiskFormat.csv". You also have the option of specifying the filename by using the --filename flag and providing a name of your choosing.

You can then load the csv file into excel and easily sort through the various disk format types.

All this is already included in the latest version of the VMware vSphere Health Check Report 5.0 if you want a centralize report that includes virtual machine disk format.

More from my site

  • How to Create an SE Sparse (Space-Efficient) Disk in vSphere 5.1
  • VM Provisioning on Datastore Clusters in vSphere 5
  • How to Use Custom VM Icons in the vSphere 5 Client
  • How to Automate the Deployment & Configuration of vShield Manager 5
  • How to Send vCenter Alarm Notification to Growl

Categories // Uncategorized Tags // api, eagerzeroedthick, ESXi 5.0, thin, vmdk, vSphere 5.0, vsphere sdk for perl, zeroedthick

Comments

  1. *protectedAlex says

    09/03/2012 at 6:43 pm

    Got the following error:
    Can't call method "rootFolder" on an undefined value at C:/Program Files/VMware/VMware vSphere CLI/Perl/lib/VMware/VICommon.pm line 1364.

    Reply
    • *protectedWilliam says

      09/03/2012 at 7:10 pm

      Are you connecting to an ESXi or vCenter Server and what version of vSphere are you using? Note, this is only applicable for vSphere 5.x

      Reply
  2. *protectedAlex says

    09/04/2012 at 4:27 am

    Tried connecting to both ESXi and vCenter (we actually have 2 vCenters in linked mode). ESXi version is 5.0.0, 768111.
    It's actually working now, thanks a lot!
    It's producing the error when I'm using ----passthroughauth for some reason.... but if I run the script without it (typing my domain user name and password), works like a charm. ~ 400 vmdks report in less than 5 secs or so.

    Reply
  3. *protectedChris says

    07/27/2015 at 2:19 pm

    Unfortunately the script ist not available any more.

    Reply
    • William Lam says

      07/27/2015 at 2:23 pm

      I've updated the article to point to my Github repo (which you can also find here https://github.com/lamw/vghetto-scripts/)

      Reply

Thanks for the comment!Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search

Thank Author

Author

William is Distinguished Platform Engineering Architect in the VMware Cloud Foundation (VCF) Division at Broadcom. His primary focus is helping customers and partners build, run and operate a modern Private Cloud using the VMware Cloud Foundation (VCF) platform.

Connect

  • Bluesky
  • Email
  • GitHub
  • LinkedIn
  • Mastodon
  • Reddit
  • RSS
  • Twitter
  • Vimeo

Recent

  • Programmatically accessing the Broadcom Compatibility Guide (BCG) 05/06/2025
  • Quick Tip - Validating Broadcom Download Token  05/01/2025
  • Supported chipsets for the USB Network Native Driver for ESXi Fling 04/23/2025
  • vCenter Identity Federation with Authelia 04/16/2025
  • vCenter Server Identity Federation with Kanidm 04/10/2025

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2025