This article provides information on thin provisioned disks within VMware ESXi/ESX.
When creating a virtual disk file, by default VMware ESXi/ESX uses a thick type of virtual disk. The thick disk pre-allocates all of the space specified during the creation of the disk. For example, if you create a 10 megabyte disk, all 10 megabytes are pre-allocated for that virtual disk.
In contrast, a thin virtual disk does not pre-allocate the space. Blocks in the VMDK file are not allocated and backed by physical storage until they are written during the normal course of operation. Reading an unallocated block returns zeroes, but the block is not backed with physical storage until it is written.
When implementing thin provisioning in VMware environment:
In ESX 3.x and VirtualCenter 2.x, the use of thin provisioning should be limited to templates. When deploying a virtual machine that used for production, VMware recommends using the Deploy a VM from template option instead of the Convert this template to VM option. This ensures that the virtual machine which is deployed using thick virtual disks. In ESX 3.x, the use of thin virtual disks in production may result in performance degradation since disk space for the thin disks is allocated as the disks grow, and the allocated disk space is likely not contiguous.
In ESX/ESXi 4.x and later versions, thin virtual disks are fully supported in production environments. You can specify whether you want create a thin or thick disk when creating virtual machines or adding disks to existing virtual machines.
These steps demonstrate the differences between a normal and a thin disk using the service console. Similar steps can be used to verify the space usage of a pre-existing thin provisioned virtual disk file:
Note: These steps make use of the du
command, which is only available in the ESX classic service console.
vmkfstools -c 10M normal.vmdk
ls -alh normal*.vmdk
-rw------- 1 root root 10M normal-flat.vmdk
-rw------- 1 root root 367 normal.vmdk
ls
utility reports that the normal-flat.vmdk
file is 10 MB in size as specified in step 1.du -h normal*.vmdk
10M normal-flat.vmdk
64K normal.vmdk
du
(disk usage) utility also reports that the normal-flat.vmdk
file is 10 MB in size.vmkfstools -U normal.vmdk
vmkfstools -c 10M -d thin thin.vmdk
ls -alh thin*.vmdk
-rw------- 1 root root 10M thin-flat.vmdk
-rw------- 1 root root 391 thin.vmdk
ls
utility reports that the thin-flat.vmdk
file is 10 MB in size as specified in step 7.du -h thin*.vmdk
2.0M thin-flat.vmdk
64K thin.vmdk
du
(disk usage) utility reports that the thin-flat.vmdk
file is only 2 MB in size.vmkfstools -U thin.vmdk
Depending on the type of storage device you are using to house a virtual disk file, it may employ a similar mechanism on the back end to maximize storage. When using NFS to store your virtual disks, you may observe similar disk usage to that of a thin provisioned virtual disk. The lower disk usage can be observed even when explicitly creating a normal or thick virtual disk.
These steps demonstrate thin provisioning on an NFS datastore:
Note: These steps make use of the du
command, which is only available in the ESX classic service console.
vmkfstools -c 10M thick.vmdk
ls -alh thick*.vmdk
-rw------- 1 root root 10M thick-flat.vmdk
-rw------- 1 root root 367 thick.vmdk
ls
utility reports that the thick-flat.vmdk
file is 10 MB in size as specified in step 3.du -h thick*.vmdk
136K thick-flat.vmdk
8.0K thick.vmdk
du
(disk usage) utility reports that the thick-flat.vmdk
file is only 136 KB in size.vmkfstools -U thick.vmdk
Note: When using thin provisioned disks with Microsoft operating systems such as Windows 2008 or Windows 7, if you perform a Full Format of the disk, this will inflate the thin provisioned disk to the full size. To avoid this situation, select the option to perform a Quick Format.