Let’s talk about virtual disks a bit – today we’re going to convert a VMDK from thin to thick provisioning. This operation is quite simple and doesn’t really require much preparation, however I thought I’ll post a quickie about it as after googling a bit, I couldn’t find an easy step-by-step guide anywhere.
Before we begin, there are few things I would like to mention first:
- Thin vs Thick Disk Provisioning – In thin provisioned disks, the size of the VMDK (at any point in time) is as much as the amount of data written out from the VM. In thick format, the VMDK is provisioned and whenever a guest issues a write it is zeroed first and then the data is written. The size of the VMDK on the datastore is same as the size of the virtual disk that was created. Optionally, the thick disk can also be eagerly zeroed which means the VMDK is pre-zeroed and assigned to the guest during provisioning of the VMFS volume.
- Requirements – Converting the VMDK from thin to thick provisioning cannot be done while the VM using it is powered on. Before proceeding, make sure you have a successful backup before carrying out any of the steps below.
- Reason – Thick provisioning will not improve the guest OS performance in any way. Please see the chart below for details:
Having all of that said, we can move on to the conversion process itself.
2. The Thin2Thick Conversion
- Power down the VM, if the VMDK you want to convert is currently in use by one;
- In vSphere (or ESXi) web GUI, navigate to the ‘Storage’ tab;
- Select the datastore hosting the VMDK which you want to convert;
- Select the ‘Browse’ button (red) and navigate in the following menu to the VMDK file;
- Right click on the VMDK file and select ‘inflate’*
- The disk inflation process can take some time depending on the provisioned size of the disk and your storage type. For disks smaller than 1TB this process shouldn’t take longer than 10min;
- After the inflation process finishes, we need to reload the VMX file of the VM using the inflated VMDK. We can achieve that in two ways: - if you don’t care about the VM’s Inventory ID, simply remove the VM from the inventory and add it back again;
- To keep the current Inventory ID of the VM, firstly we need to log through SSH into the ESXi host on which the VM is located.
- Run the following command to find the VM’s current Inventory ID:
[root@esxi] # vim-cmd vmsvc/getallvms
Vmid Name File Guest OS Version Annotation
1269 Thin2ThickVM [local] Win .vmx winNetEnterpriseGuest vmx-09 example VM
After getting the Inventory ID, we can run the following command to reload the VMX file:
[root@esxi] # vim-cmd vmsvc/reload 1269
If the ‘inflate’ option is missing then it means the VMDK you’re trying to convert is already thick provisioned, while if the ‘inflate’ option.
After reloading the VMX file, the change we’ve applied to the VMDK should now be visible in vCenter/ESXi GUI. You can now safely turn on the VM and check if it’s alright.
Read all other the posts of the "Quickie" series in the archive