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 Provisionvirtual disks to the
Thick Provision Eager Zeroedtype.
- 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.
Set-HardDiskcmdlet. 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.
- 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
-Confirmparameter, 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!
- Of course, you can answer
[A] Yes to Allor cancel the request at all using
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-Progresscmdlet, indicating the VM name, currently converted disk info and the progress.
- The average convert speed on Datastores, located on SAN, supporting VAAI is approximately 200GB/hour. Disks in Independent Mode converted nearly 2 times slower!
- Pay attention to the
Resultproperty. The conversion process run as a task and its progress and the result can be seen in the vSphere/Web Client in the
- The value of
successin the function corresponds to the
Statusfield in the
TimeMinproperty is the number of minutes spent on each disk conversion.
- 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