When you create a virtual disk in VMware you are offered to provision it as "thick" or "thin". Thick meaning a 120GB virtual hard drive will result in a 120GB vmdk file. Thin meaning the vmdk file will grow based on the actual used space of the virtual hard drive.
As I began creating and converting physical machines or from VMware Workstation to our VSphere servers, I didn't really pay attention to whether they were set for Thick or Thin provisioning. But as I started exploring backup options of our virtual server farm it quickly became obvious that we needed to convert those machines that were configured as Thick drives to Thin ones so that we could save on backup storage space and decrease the amount of time it was taking to back them up over the network.
But how do you convert one to the other? Apparently going from Thin to Thick is easy, but doing the opposite is not as straight forward.
From what I've read if you have VMware VCenter, you simply right-click on the machine and convert it, but we don't have that. Even in VMware workstation there doesn't seem to be an easy option. I also found some rather elaborate scripts that people have written, but I wanted something a little more fool-proof and something I could control rather than trusting my soul to a script I didn't write.
In the end I found that I could do it using the free VMware vCenter Converter Standalone Client.
The following are the steps I went through to convert the disks in a virtual machine from Thick to Thin. In this case I was working with a virtual machine that is running on a VSphere 5 server. This step-by-step also assumes you're already familiar with the Standalone converter.
1) First shutdown the virtual machine.
2) Open VMware Converter and choose the "Convert Machine" button and follow the wizard. You will select your source and target. For my source the virtual machine name was FLAKE so I made my target name be FLAKE_X. This means my source vmdk file for drive C: happens to be FLAKE.vmdk but my converted one will be named FLAKE_X.vmdk. Just name your new machine with a suffix you'll recognize later.
This machine also has a drive D: so the original vmdk file is FLAKE_1.vmdk and after the conversion it will be FLAKE_X_1.vmdk. You might also consider browsing your Datastore in the vCenter Client before you begin to get a sense of how the current vmdk files are named.
To do this, click on the root (or top) of the list of Virtual Machines, then click the Configuration tab, under Hardware click Storage, then right-click on the Datastore you want and choose Browse Datastore.
3) In my case I'm converting to the same VSphere server (target) but the original virtual machine was on Datastore2 and there isn't enough free space on that volume to hold the converted disks. So for the target destination I chose Datastore1. The point here is you might want to do some math to make sure you have enough free space to do the conversion. If you have sufficient space, choose your target to be the same Datastore as the source as this will save you time when you move the vmdk files later.
4) In the wizard when you get to the Options screen on the section that says Data to copy, choose the Edit button. In there you will see the pull-down options under the Type column to choose Thin for each drive. After this, no other changes are needed so click to Finish the wizard and the conversion will begin. Even on a modest sized drive(s) this will take some time, so go to lunch. My conversion of drives that total 200GB in size estimated 9 hours, so I went to bed.
Another side note of interest. When running the vCenter Converter client on XP it gives you a percentage of your progress and a time estimate. When running this on a Windows 7 machine it just says it is running and no time estimate or progress bar so you're left guessing how long it takes.
5) Once the conversion is complete you can move the newly created vmdk file(s) to the same location as the original. If you created your new VM on the same datastore this will only take a few seconds. This is that time-saving step I mentioned before. In my case, since I had a minimal amount of space on the original Datastore I left the new vmdk files alone for now.
To relocate the vmdk files open the vSphere Client, click on the root (or top) of the list of Virtual Machines, then click the Configuration tab, under Hardware click Storage, then right-click on the Datastore you want and choose Browse Datastore. Drill down until you find your new vmdk file(s) and right-click on it and choose Move to.
6) Now edit the Virtual Machine settings of your original VM (the source) and remove each hard disk from the configuration and then add them back but point to the new "Thin" disk files.
As a side note, after you click to remove the drives do not click OK on the configuration screen before you add the new drives. Otherwise it will also remove your disk controller (typically a SCSCI controller) and if you had a unique controller defined you would need manually to redefine it the same as it was before.
7) Start your virtual machine and verify that it boots correctly.
8) Then you can browse the datastore and delete the old "Thick" vmdk files.
In my case (because of my storage space issues), I powered down the VM again, deleted the Thick files from Datasore2 and then moved the "Thin" vmdk files from the Datastore1 to Datastore2. Then I edited the VM again to point the drives to the new locations of the vmdk files.
9) When you are finished you can right-click on the newly created VM (the target or FLAKE_X in this example) and choose to Delete From Disk.
Although this is a time-consuming process I estimate we are saving close to a Terabyte in storage space across our VSphere servers and even more on our backup devices.
I just wish I could find a tool for my waistline to convert it from Thick to Thin.