The reason why Administrator can start to look for solution on disk conversion from Thick to Thin on VMware ESXi is the low speed of the disk subsystem when writing files. By default, the type of the newly created virtual disk is Thick Provision Lazy Zeroed format, which is adversely affects the future performance of the system. It’s better to use Thin Provision or Thick Provision Eager Zeroed (in this case, the entire disk space is filled with zeros, slowing the process of creating a disk, but increasing the speed of work in the future).
There are two different ways for converting Thick Provision Disk to Thin Provision:
- using Storage vMotion feature of a VMware vSphere
- using CLI (the only one way to convert disk on a standalone VMware ESXi host)
Changing the Thick to Thin Provisioning of a virtual disk Using Storage VMotion
Using Storage vMotion feature of a VMware vSphere, you can relocate any virtual machine with disk to different VMFS storage (different LUN) without interruption of services and applications. During migration of VM disks between storages, you can also change the type of the disk.
To get the current disk provisioning type for the specific VM, you have to open it’s settings and check the value of the disk type field. In our case the type of virtual disk is Thick provision lazy zeroed.
To change the disk type, you should move VM files to another datastore.
Tip. If you have only 1 VMFS datastore, you can create temporary additional storage on any Windows server and connect it to the ESXi server via NFS.
Open Virtual Machine action menu and select Migrate.
Select the migration type Change storage only.
Select Thin Provision as a virtual machine disk format and choose one of the available VMFS/NFS storage on which you want to migrate the VM. Click Next.
Wait until the virtual machine files will be moved to the new storage.
Now make sure that the type of the disc is changed to Thin provision.
How to Change Disk Provisioning Type using ESXI CLI
The method of changing disk provisioning type using CLI involves copying current vmdk file to a new thin provisioned disk and removing old thick disk.
At first, you should power off your VM. To connect to the ESXi host CLI over SSH, you have to enable SSH service in the ESXi settings and allow incoming connection on TCP/22 port (Manage > Settings > Security Profile).
Connect to ESXi server as root using favorite SSH client (for example, Putty) and change directory to the vmfs/volumes:
List the available datastores:
And go to the folder, containing your VM files.
List the files containing in the directory:
We are interested in the file w10rtm-test.vmdk. To convert this file from Thick to Thin, run the following command:
vmkfstools -i w10rtm-test.vmdk -d thin w10rtm-test-thin.vmdk
After the convertation is completed, delete the original Thick disk file w10rtm-test.vmdk:
And rename the resulting Thin disk:
mv w10rtm-test-thin.vmdk w10rtm-test.vmdk
Now using vSphere Client or vSphere Web client open the VM settings and delete old disk (Select Remove from virtual machine). After that add new disk : Add > Hard Disk > Use an existing virtual disk > select file w10rtm-test.vmdk on your datastore > Next > Finish.
Now, you can power on your VM.