Skip to content

Convert thick provisioned disk to thin on VMware ESXi

You want to save disk space and convert thick provisioned disk to thin on VMware ESXi 6.7. It’s good to know that there are three disk types in VMware. Thick provision eager zeroed, thin provision and thick provisioned lazily zeroed, which is the default. You get the task to save disk space on the datastore, and the best advice is to convert thick provisioned to thin on VMware ESXi. What are the options to convert from thick provisioned lazy zeroed disk to thin, and how to do that?

VMware disk types

  • Thick Provision Lazy Zeroed: is a disk that takes all of its space at the time of its creation, but this space may contain some old data on the physical media. This old data is not erased or written over, so it needs to be “zeroed out” before new data can be written to the blocks. This type of disk can be created more quickly, but its performance will be lower for the first writes due to the increased IOPS (input/output operations per second) for new blocks.
  • Thick Provision Eager Zeroed: is a disk that gets all of the required space still at the time of its creation, and the space is wiped clean of any previous data on the physical media. Creating eager zeroed disks takes longer, because zeroes are written to the entire disk, but their performance is faster during the first writes. This sub-type of thick-provisioned virtual disk supports clustering features, such as fault tolerance.
  • Thin Provision: Thin provisioning is another type of storage pre-allocation. A thin-provisioned virtual disk consumes only the space that it needs initially, and grows with time according to demand.

Read more about Thick and Thin Provisioning: What Is the Difference?

How to convert thick provisioning to thin

Convert thick disk provisioning to thin on VMware ESXi with the options:

  1. VMware converter
  2. VMware vCenter (vMotion)
  3. VMware command line (this article)

If you do have vCenter configured, it’s best to move a VM with VMotion and select the virtual disk format Thin Provision in the wizard. You can use VMware converter or command line if you don’t have vCenter, you only have one ESXi host, or don’t want to spend a license to get more features.

Convert thick provisioned to thin with vmkfstools in ESXi Shell (command line)

In this step by step guide, you will learn how to convert a thick provisioned lazy zeroed disk to thin on VMware ESXi 6.7. The steps are the same for other ESXi versions. You will use the vmkfstools command.

The vmkfstools command offers the ability to clone virtual machine content and also convert from one virtual machine disk (.vmdk) format into another.

Read the VMware documentation about cloning and converting virtual machine disks with vmkfstools.

Step 1. Check VMware hard disk type

Log in to VMware ESXi. Click in the left menu on Virtual Machines. In the Virtual Machine list view, right-click on the VM and click Edit Settings.

Good to check is the VM used space. The used space column shows the VM as 60 GB used space.

Convert thick provisioned disk to thin on VMware ESXi edit settings

Expand the Hard disk and check the Type. The hard disk type is thick provisioned, lazily zeroed.

Convert thick provisioned disk to thin on VMware ESXi disk type thick provisioned lazily zeroed

Step 2. Shut down VM

Shut down the VM that you want to convert if you did not do that already.

Virtual machine disk files are locked while in-use by a running virtual machine.

Convert thick provisioned disk to thin on VMware ESXi VM shut down

Step 3. Enable SSH on VMware ESXi host

Enable SSH via the GUI. Expand Host and click on Manage. Click the tab Services and find the service name TSM-SSH. Click on Start.

Convert thick provisioned disk to thin on VMware ESXi 01 start TSM-SSH service

An information banner will show up that the service TSM-SSH successfully started.

Step 4. SSH into the ESXi host

SSH into the host with the application Putty.

Convert thick provisioned disk to thin on VMware ESXi Putty configuration

Log in with the user privileges account.

login as: root
Keyboard-interactive authentication prompts from server:
| Password:
End of keyboard-interactive prompts from server
The time and date of this login have been sent to the system logs.

WARNING:
   All commands run on the ESXi shell are logged and may be included in
   support bundles. Do not provide passwords directly on the command line.
   Most tools can prompt for secrets or accept them from standard input.

VMware offers supported, powerful system administration tools.  Please
see www.vmware.com/go/sysadmintools for details.

The ESXi Shell can be disabled by an administrative user. See the
vSphere Security documentation for more information.

Step 5. Navigate to the VM folder

Navigate to the VM folder under /vmfs/volumes/ with the command cd vmfs/volumes.

[root@localhost:~] cd vmfs/volumes

List the name of the VM store with ls -lh

total 1792
drwxr-xr-x    1 root     root           8 Jan  1  1970 5c0b0ded-b7a4a6f0-3ff8-6d6c6426e4f1
drwxr-xr-t    1 root     root       76.0K Jan  5 20:06 5e88aaf7-7ab335e2-4adc-1c697a0f86bd
drwxr-xr-x    1 root     root           8 Jan  1  1970 5e88eeda-f0c3ecce-d429-1c697a0f86bd
drwxr-xr-x    1 root     root           8 Jan  1  1970 62577ee5-b5de7369-1044-083e27a116b0
lrwxr-xr-x    1 root     root          35 Jan  5 20:42 datastore01 -> 5e88aaf7-7ab335e2-4adc-1c697a0f86bd

Change to the directory of the datastore. In this example, cd datastore01.

[root@localhost:/vmfs/volumes] cd datastore01
[root@localhost:/vmfs/volumes/5e88aaf7-7ab335e2-4adc-1c697a0f86bd]

List the VM names in the datastore with ls -lh.

[root@localhost:/vmfs/volumes/5e88aaf7-7ab335e2-4adc-1c697a0f86bd] ls -lh
total 1024
drwxr-xr-x    1 root     root       72.0K Jan  5 19:08 DC01-2016
drwxr-xr-x    1 root     root       76.0K Jan  5 19:14 EX01-2016
drwxr-xr-x    1 root     root       76.0K Jan  5 19:08 EX02-2016
drwxr-xr-x    1 root     root       76.0K Jan  5 20:02 FS01-2016
drwxr-xr-x    1 root     root       72.0K Jan  5 20:06 ISO
drwxr-xr-x    1 root     root       72.0K Jan  5 19:08 KLB01
drwxr-xr-x    1 root     root       72.0K Jan  5 19:17 PC01

Change to the directory of the VM. In this example, it’s the file server FS01-2016. Run the command cd FS01-2016.

[root@localhost:/vmfs/volumes/5e88aaf7-7ab335e2-4adc-1c697a0f86bd] cd FS01-2016
[root@localhost:/vmfs/volumes/5e88aaf7-7ab335e2-4adc-1c697a0f86bd/FS01-2016]

Run the command ls -lh to list the files in the directory.

[root@localhost:/vmfs/volumes/5e88aaf7-7ab335e2-4adc-1c697a0f86bd/FS01-2016] ls -lh
total 62916608
-rw-------    1 root     root       60.0G Jan  5 22:04 FS01-2016-flat.vmdk
-rw-------    1 root     root      264.5K Jan  5 22:04 FS01-2016.nvram
-rw-------    1 root     root         450 Jan  5 21:58 FS01-2016.vmdk
-rw-r--r--    1 root     root           0 Jan  5 21:58 FS01-2016.vmsd
-rwxr-xr-x    1 root     root        3.2K Jan  5 22:04 FS01-2016.vmx
-rw-r--r--    1 root     root      226.5K Jan  5 22:04 vmware.log

Step 6. Clone the VMDK to a thin provisioned disk using vmkfstools

Use the command vmkfstools -i FS01-2016.vmdk -d thin FS01-2016-thin.vmdk.

[root@localhost:/vmfs/volumes/5e88aaf7-7ab335e2-4adc-1c697a0f86bd/FS01-2016] vmkfstools -i FS01-2016.vmdk -d thin FS01-2016-thin.vmdk
Destination disk format: VMFS thin-provisioned
Cloning disk 'FS01-2016.vmdk'...
Clone: 100% done.

List the files in the directory and verify that two files are created: FS01-2016.thin-flat.vmdk and FS01-2016.thin.vmdk.

[root@localhost:/vmfs/volumes/5e88aaf7-7ab335e2-4adc-1c697a0f86bd/FS01-2016] ls -lh
total 72898560
-rw-------    1 root     root       60.0G Jan  5 22:04 FS01-2016-flat.vmdk
-rw-------    1 root     root       60.0G Jan  5 22:07 FS01-2016-thin-flat.vmdk
-rw-------    1 root     root         504 Jan  5 22:07 FS01-2016-thin.vmdk
-rw-------    1 root     root      264.5K Jan  5 22:04 FS01-2016.nvram
-rw-------    1 root     root         450 Jan  5 21:58 FS01-2016.vmdk
-rw-r--r--    1 root     root           0 Jan  5 21:58 FS01-2016.vmsd
-rwxr-xr-x    1 root     root        3.2K Jan  5 22:04 FS01-2016.vmx
-rw-r--r--    1 root     root      226.5K Jan  5 22:04 vmware.log

Step 7. Rename old flat file

Rename the old file with the command mv FS01-2016-flat.vmdk FS01-2016-flat.vmdk.old.

[root@localhost:/vmfs/volumes/5e88aaf7-7ab335e2-4adc-1c697a0f86bd/FS01-2016] mv FS01-2016-flat.vmdk FS01-2016-flat.vmdk.old

Step 8. Rename new flat file

Rename the thin flat file with the command mv FS01-2016-thin-flat.vmdk FS01-2016-flat.vmdk.

[root@localhost:/vmfs/volumes/5e88aaf7-7ab335e2-4adc-1c697a0f86bd/FS01-2016] mv FS01-2016-thin-flat.vmdk FS01-2016-flat.vmdk

Step 9. Unregister VM from ESXi

This is necessary for the host to recognize the new disk type. Right-click VM > Unregister.

Convert thick provisioned disk to thin on VMware ESXi unregister VM

Click Yes.

Confirm with Yes to unregister VM

Step 10. Register VM in ESXi

Click on Create / Register VM.

Convert thick provisioned disk to thin on VMware ESXi create/register VM

Select Register an existing virtual machine. Click on Next.

Convert thick provisioned disk to thin on VMware ESXi register an existing virtual machine

Click on Select one or more virtual machines, a datastore, or a directory.

Convert thick provisioned disk to thin on VMware ESXi select VM for registration

Open the VM FS01-2016 and select the FS01-2016.vmx file. Click Select.

Convert thick provisioned disk to thin on VMware ESXi select VMX file

Click on Next.

Select VMs for registration screen

Click Finish.

Ready to complete screen

Step 11. Verify hard disk type conversion

Check the VM hard disk size. In this example, the hard disk changed from 60 GB to 9.56 GB.

Convert thick provisioned disk to thin on VMware ESXi verify VM used space

Right-click on the VM and select Edit Settings.

Convert thick provisioned disk to thin on VMware ESXi VM edit settings

Expand hard disk and check the Type. It shows as Thin provisioned.

Convert thick provisioned disk to thin on VMware ESXi disk type thin provisioned

Step 12. Start the VM

Start the VM and check that everything works as expected.

Step 13. Delete unnecessary VMDK files

Clean up and remove the files. Run the command rm FS01-2016-thin.vmdk && rm FS01-2016-flat.vmdk.old.

[root@localhost:/vmfs/volumes/5e88aaf7-7ab335e2-4adc-1c697a0f86bd/FS01-2016] rm FS01-2016-thin.vmdk && rm FS01-2016-flat.vmdk.old

Conclusion

In this article, you learned how to convert thick provisioned disk to thin on VMware ESXi. Check the disk type before you start to convert from thick to thin disk in the command line interface. Verify the conversion at the end and start up the system to make sure all is working.

Did you enjoy this article? You may also like Install Kemp virtual load balancer on VMware. Don’t forget to follow us and share this article.

ALI TAJRAN

ALI TAJRAN

ALI TAJRAN is a passionate IT Architect, IT Consultant, and Microsoft Certified Trainer. He started Information Technology at a very young age, and his goal is to teach and inspire others. Read more »

This Post Has 12 Comments

  1. This is a wonderful step-by-step article and saved me a half TB of space on VM’s that were over-provisioned.

    Thank you.

  2. Hey,

    Thanks for your nice tutorial!
    I also tried to follow your instructions but I seem to have another problem. My vm says it has a thin provisioned disk 80GB in vm properties (real disk usage 14,8 of 80 GB in Windows) but it still shows used space 80 GB in vmware. Do you know what could cause this problem?

    Thank you so much in advance!

  3. My storage is completely full as is? How do I do this if I don’t have the space to make a copy of the VM?

  4. Thanks and excellent write-up. It worked great for me on an esxi 6.7 with update 3 host.

  5. thank you for your post, some additional information for ESXi6.7

    – If you have multiple vmdk files (i.e XX-00001.vmdk) shut down the vm and go to Snapshot > Consolidate disks. This will reduce it to the original vmdk file.
    – In my case, I was not able to start the VM. So i try around and find out that I only need to replace the new XX-flat.vmdk file. Then I was able to start the VM

    1. Thanks for the tutorial!

      Cola, your 6.7 findings did it for me as well. Just do not replace the XX.vmdk, only replace the XX-flat.vmdk fixed the system from not recognizing the disk.

Leave a Reply

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