Convert Thick Provision Lazy Zeroed Disk to Thin on VMware ESXi

The reason why the Administrator can start to look for a solution on disk conversion from Thick to Thin on VMware ESXi is that thick virtual disks are taking up more storage space than they need. By default, the type of the newly created virtual disk on VMWare ESXi is Thick Provision Lazy Zeroed format, which 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).

Types of Virtual Disk on VMWare

VMWare uses three types of disks:

  • Thick Provision Lazy Zeroed — all space of such virtual disk is allocated upon creation, while the blocks are not cleared of the data that was there earlier. When the virtual machine first accesses a new block, it is cleared. The first time a block is accessed on such a disk, I/O performance for the clear operation is lost. The VM then accessed such a data block next time, the performance is identical to Eager zeroed Thick. This type of disk is created for virtual machines that are using the VMware vSphere client by default;
  • Thick Provision Eager Zeroed — all space of such disk is allocated at the time of creation, and all storage blocks are cleared of the data that was there earlier. The advantage of such disk is performance and security, the disadvantage is the long creation time;
  • Thin Provision (or dynamically) — virtual disks are initially created with minimum size and grow as they fill up with data to the specified vmdk file size. When a new block is filled up with the data, it is cleared beforehand. Such disks are the least productive (need some time for allocating a new block and cleaning it), but the most optimal in terms of saving space on the storage. Thin provisioned disks allow storing more virtual machines in the same VMFS datastore.
READ ALSO  How to Convert ESD to WIM File on Windows 10?

Note that if the disk space on the datastore is exhausted and the thin disk cannot be expanded, the virtual machine will stop working.

Hint. Using PowerCLI, you can find out used and provisioned disk size for a specific virtual machine:

Get-VM -Name VMName1 | Select Name,@{N=’Used (GB)’;E={[math]::Round($_.UsedSpaceGB,2)}},@{N=’Provisioned (GB)’;E={[math]::Round($_.ProvisionedSpaceGB,2)}} | Format-List

There are three different ways for converting Thick to Thin Provision Disk:

  • Using Storage vMotion feature of a VMware vSphere;
  • Using CLI (the only one way to convert disk on a standalone VMware ESXi host);
  • Using VMWare Converter.

Changing the Thick to Thin Provisioning of a Virtual Disk Using Storage VMotion

Using the Storage vMotion feature of a VMware vSphere, you can relocate any virtual machine with a disk to a different VMFS datastore (different LUN) without interruption of services and applications in a running VM. During a 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 its settings in vSphere Client and check the value of the disk type field. In our case, the type of virtual disk is Thick provision lazy zeroed.

convert thick to thin vmware

To change the disk type, you should move VM files to another datastore.

Tip. If you have only 1 VMFS datastore, you can create a temporary additional NFS file share on any Windows server and connect it to the ESXi server via NFS.

Open the Virtual Machine action menu and select Migrate.

thick provision lazy zeroed to thin

Select the migration type Change storage only.

vmware convert thick to thin

Now in the Select virtual disk format field, choose which format you want to convert the vmdk during Storage vMotion. Select Thin Provision as a virtual machine disk format and choose one of the available VMFS/NFS datastore on which you want to move the VM files. Click Next.

READ ALSO  How to Install VMWare Tools on Guest VMs?

esxi convert thick to thin

The new Relocate virtual machine task will appear in the vSphere Resent task pane. Wait until the virtual machine files will be moved to the new storage.

vmware thick to thin

Now make sure that the type of the disc is changed to Thin provision.

Tip. When migrating a virtual machine to any storage other than the VMFS file system, virtual disks are always converted to Thick format and will take up their maximum size.

How to Change Disk Provisioning Type using ESXI CLI?

The way of changing VMWare virtual disk provisioning type using CLI involves copying the current vmdk file to a new thin-provisioned disk, and removing the 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 (open on the ESXi host: Configuration > Services). Select the SSH service and press Start.

change thick to thin provisioning vmware

Connect to ESXi server as root using a favorite SSH client (for example, Putty), and change directory to the vmfs/volumes:

# cd /vmfs/volumes

List the available datastores:

# ls –lh

And go to the folder, containing your VM files.

vmkfstools thick to thin

List the files containing in the directory:

# ls

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

Note. Before starting disk conversion, make sure you have enough space to convert the virtual machine’s disk from thin to thick.

Hint. Several examples of creating disks of a certain type from ESXi cli using the built-in vmkfstools tool:

# vmkfstools –c 40G –d thick thick.vmdk

# vmkfstools –c 40G –d zeroedthick zeroedthick.vmdk

# vmkfstools –c 40G –d eagerzeroedthick eagerzeroedthick.vmdk

After conversion completes, delete the original Thick disk file w10rtm-test.vmdk:

# rm 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 the old disk (Select Remove from virtual machine). After that add new disk: Add new device > Existing Hard Disk > Use an existing virtual disk > select file w10rtm-test.vmdk on your datastore > Next > Ok.

READ ALSO  Configure Autostart of VM on VMware ESXi

vmware change thick to thin

Now, you can power on your VM.

Converting Thick to Thin Disk Using VMware Converter

VMware Converter Standalone is a free application that can be installed on Windows to convert physical machines (P2V) or virtual machines (V2V) to VMWare format.

Using VMware Converter, you can convert a VM to a new VM on the same ESXi host, but with a new disk format (you can even reduce the provisioned size of disks, which is not supported in vSphere Client).

  1. Download and install VMware Converter Standalone on any Windows computer. Run the conversion wizard;
  2. Specify that vSphere Virtual Machine needs to be converted;
  3. Specify vCenter/ESXi hostname and credentials to access it;
  4. At the Source Data step, you can specify the new size of the virtual disks and the disk provisioning type. Choose Thin;
  5. The converter will create a new VM with disks of the required size. Copy the data and reduce the size of the guest OS file system partition.

convert thick provisioned to thin vmware

Cyril Kardashevsky

Leave a Reply

Your email address will not be published. Required fields are marked *

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