I found myself needing to change some disks in my VMs from thick (pre-allocating all the defined storage) to thin (dynamically resizing storage up to the maximum size configured. I found myself running out of disk space after creating a few snapshots.

First, to clarify a bit of confusion, I ran into. When I first attempted this, I logged into my ESXi host machine, and navigated to the VM directory I wanted to modify. Logically, I chose the largest vmdk file thinking that is one I want to change. Well, it turns out this isn’t the vmdk file you want to run vmkfstools against. To determine the file name, I brought up the vSphere Client and right mouse clicked on the VM, and chose Edit Settings. Then, I clicked on the hard disk I wanted to modify. From here, I was able to identify the filename I needed (under “Disk File”). Knowing this, I simply needed to run vmkfstools.

vmkfstools -i inputfilename outputfilename -d thin

Once completed, you replace the thick file with the thin file. The simplest way, to me, seems to be to remove or rename the thick file, and edit the vmx configuration file to use the new thin vmdk output file created when the vmkfstools was run. Then, I removed the server from the vSphere client by right mouse clicking on the VM and selecting “Remove from Inventory.” Then, I added the VM back into the invetory by clicking on ESXi host, right mouse clicking on the datastore where the VM is stored, and browsing to the VM directory. From here, I chose the updated vmx file to add the VM to the inventory.

There are several other options to the vmkfstools command including other disk formats including converting back to a thick disk format.

Note: When you look at the files via an ssh client, it does not look like you have changed anything with regards to space. To verify that it has worked, look at the hard disk for the VM. It should indicate that the type is Thin.