When adding disks to a VM in vSphere you may have seen “Disk Provisioning type” and wondered what the benefits of each type were. Disk performance and disk space used are what governs the decision to use each type.
The 3 disk provisioning types are “Thick Provision Lazy Zeroed”, “Thick Provision Eager Zeroed”, “Thin Provision”. The things I want to explain are the difference between “thick” and “thin” disk and the difference between “eager” and “lazy” zeroing.
THICK AND THIN DISK
You may know that each virtual disk is created as a VMDK file in a datastore in ESX (the VMware server AKA the Hypervisor). Say for example we create a 40 GB disk. In a THICK provisioned disk, and 40 GB VMDK file would be created in the datastore. All of that disk space is allocated to the virtual disk. Even if the VM hasn’t written anything to that disk yet, that disk space is fully allocated. Contrast that with THIN provisioning. With a thin provisioned disk, only the space being used by the VM is actually allocated. So at first, it takes up almost no space. As the VM fills up the disk, ESX will grow the VMDK file, up to the size defined in vSphere (in our example, 40 GB). There is a slight disk performance hit with thin provisioning. Another thing to look out for is you can accidentally over allocate thin disk to the point that you run out of disk and prevent thin disk from growing. A very bad situation you don’t want to be in. Thin provisioning is rarely used in a production environment.
EAGER AND LAZY ZERO
Before a block on the virtual disk can be used, each block must be zeroed out. That’s literally where ESX writes zeros over the disk block so the VM can use it. If we are EAGER, then as the disk is created, it’s all zeroed out. This will make the disk creation time take longer. If we are LAZY, we only zero out a block as it’s needed, whether today or next year. You take a minor disk performance hit when you write to unused disk space. So to maximize disk performance for disk intensive applications, like databases, use Thick Provision Eager Zero.
CHANGING PROVISIONING TYPE
So now you may say “Oh no, my database disk is Thin and I want it to be Thick Provisioned Eager Zero, how do I do that?”
You may have noticed that vSphere doesn’t give you a check box to change the provisioning type of a virtual disk. However, you can change it with this little trick. Migrate the disk to another datastore, you will get the option to change the provisioning type while migrating.