At the end of last year I have reinstalled my home lab environment from Microsoft Hyper-V to VMware ESXi. I converted my VM’s to the ESXi format with the VMware Offline converter. This process was going smoothly. To be honest way smoother that expected. I worked a lot with VMware in the past but since I started working at PQR I worked with VMware more and more. I really like the management features in VMware vCenter.
Recently I noticed that the free diskspace on my datastore was reduced to 20 GB. Since my VMware environment consists of just one host with one datastore I can’t convert my VM’s by vMotioning them to the other datastore. While doing some research online I found a method to convert the VM from Thick to Thin disk mode.
To enable SSH from the vSphere Web Client (this is the webclient on the ESXi host) do the following:
- Select the host and click Manage, and select Settings.
- Click Security Profile
- In the Services section, click Edit
- Sellect SSH, and start the service
- Click OK.
Connect with Putty or a any other SSH client (I used the Terminal app on my MacBook) to connect to the ESXi host and logon with your root credentials.
First and foremost, make sure that the VM your are going the clone is powered down.
Navigate to the folder that holds the target VM.
cd /vmfs/volumes/datastore1/Core01
Clone the vmdk to a thin provisioned disk using vmkfstools
vmkftools –i Core01.vmdk –d thin-Core01.vmdk
Rename the old flat file mv Core01-flat.vmdk Core01-flat.vmdk
Rename the new flat file mv thin-Core01-flat.vmdk Core01-flat.vmdk
Unregister VM from ESXi inventory, this is necessary for the host to recognize the new disk type. (Right-Click Core01>Unregister
Re-register the VM (Create / Register VM> Register an existing virtual machine, browse to the folder that holds the machine that you want to register and select the vmx file.
Boot the VM, and make sure it boots succesfull and all is well.
Remove unnecessary vmdk files rm thin-Core01.vmdk && rm Core01-flat.vmdk.old
After cloning all my VM’s from Thick disk to Thin disk I have 341,93 GB free disk space.