How to convert Thin Provision VMDK disks to Eager Zeroed Thick w/PowerCLi

Cover

Today’s article will tell you about one more function from my PowerCLi Vi-Module module. Function Convert-VmdkThin2EZThick.

Import-Module Vi-Module -Force
Get-Command –Module Vi-Module
Get-Alias -Definition Convert-VmdkThin2EZThick

Convert? For what?

  • As you can understand from its name, it converts all VM’s Thin Provision virtual disks to the Thick Provision Eager Zeroed type.

01.Convert-VmdkThin2EZThick

  • It may be necessary for several reasons. I do not want to provoke the eternal debate about performance, so bring an indisputable argument – application requirements. Maybe someone is surprised, but still there is a sufficient number of «virtualization-unfriendly» applications that do not support the main benefits of virtualization, such as Snapshots, vMotion, Thin Provisioning, etc.

How to convert?

  • I found three ways to convert virtual disks, and each of them, in my opinion, has a small drawback.

  • Let start with vmkfstools. This method requires a direct SSH connection to the ESXi host. In addition, you need to know the host where desired VM registered at this moment.

  • Inflate option, available in the GUI (Datastore Browser in the vSphere Client) not always convenient since if the VM is in SDRS Cluster, it is not so easy to find on what Datastore is a specific virtual disk resides now.

  • Finally, built-in Set-HardDisk cmdlet. Very powerful and unwieldy weapon that will require you mass of checks before passing it a virtual disk for processing (including whether the VM powered off, is there snapshot on the disk, is it RDM disk and so on).

  • Well, we got to my function. I tried to deprive it of all the above drawbacks.

Convert-VmdkThin2EZThick

  • The function takes as a parameter one or more VMs and converts all their thin disks that does not have the snapshots if the machine is powered off.

Get-VM VM1 | Convert-VmdkThin2EZThick
  • Since the function performs an irreversible action, it supports the -Confirm parameter, which defaults to $true, i.e. it requires confirmation of your intentions.
  • The confirm asked per virtual disk, so you must not convert all of them!

02.Convert-VmdkThin2EZThick

  • Of course, you can answer [A] Yes to All or cancel the request at all using –Confirm:$false.
Get-VM VM1, VM2 | Convert-VmdkThin2EZThick -Confirm:$false
  • Be careful with this parameter. On mistake, you can stop the function by Ctrl+C, but you cannot interrupt current disk’s conversion which have been already started!
  • Regarding the «irreversible action». It is impossible to convert the virtual disk from the thick type back to the thin type and it is not the limitation of my function. Of course, it is possible to change the Disk Type to Thin Provision during cloning, but it will be another disk and, strictly speaking, there is cannot be considered as converting.

  • Since the conversion process can take quite a long time, the function displays the progress directly in the PowerCLi console using the Write-Progress cmdlet, indicating the VM name, currently converted disk info and the progress.

03.Convert-VmdkThin2EZThick

  • The average convert speed on Datastores, located on SAN, supporting VAAI is approximately 200GB/hour. Disks in Independent Mode converted nearly 2 times slower!

Returned objects

  • Pay attention to the Result property. The conversion process run as a task and its progress and the result can be seen in the vSphere/Web Client in the Recent Tasks panel.

04.Convert-VmdkThin2EZThick

  • The value of success in the function corresponds to the Completed in the Status field in the Recent Tasks panel.
  • The TimeMin property is the number of minutes spent on each disk conversion.

Summary

  • For more details about the function, please take a look at the content based help and examples.
Get-Help Convert-VmdkThin2EZThick -Full
Get-Help Convert-ViMVmdkThin2EZThick -Examples
Get-Help thin2thick -Parameter VM

You may also like:

Test-VMHotfix/Test-VMPing – Check VMware VM for installed Hotfixes
Set-MaxSnapshotNumber – Control maximum number of VMware snapshots
Move-Template2Datastore – Migrate VMware VM Templates to another Datastore
Get-RDM – How to get RDM (Raw Device Mappings) disks

4 thoughts on “How to convert Thin Provision VMDK disks to Eager Zeroed Thick w/PowerCLi

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s