Currently running vSphere 6.7. I have a few VMs that have disks in which I am unable to convert from thick to thin. I've attempted storage vmotions for these disks, with Thin Provisioning selected, and attempted with the VMs powered on and off, but the disk type will not change. Any ideas on what could be causing this?
a thick provisioned vmdk that is 50% filled with data CAN be converted to a thin provisioned \VMDK
a thick provisioned vmdk that is 100% filled with data CAN NOT be converted to a thin provisioned \VMDK
@continuum Hmm, not sure if it's a disk space issue. There are two VMs I'm having issues with. One is a linux applicance with a very small disk of around 1 MB. I can understand why this one will not covert so it's not really important. Can leave as is.
The other VM is Windows 2012. The disk in question is 175GB with 65GB of available disk space. Would that be enough to cause the disk not to convert to thin provisioned?
How do you know that your 175 gb has only written 65gb ?
And a 1MB vmdk sounds very suspicious - please add details.
By the way - to figure out the provisioning type of a given vmdk there is only one reliable way:
Query the flat.vmdk with the command vmkfstools -p 0 name-flat.vmdk > result.txt
If results.txt has even a single line containing VMFS -Z it is lazy zeroed.
If results.txt has even a single line not containg VMFS it is thin provisioned.
For this test ignore the first line of results.txt - thats the info part.
Every line that follows specifies the allocation of a fragment of the flat.vmdk.
> Windows shows 65 GB available for that disk
That is nice to know but irrelevant to the question.
A flat.vmdk is used to 100% if each single 1 MB block of has been used once.
If the guestOS cleans up the trashbin later this does not change the state of those one MB blocks.
When ever you write at least one byte to a one MB block of a vmdk this block changes its state from thin or lazy zeroed to eager zeroed.
To change an eager zeroed one MB block back to a thin provisioned block you must use a function that reclaims the space - such as vmkfstools -i cuurent.vmdk thin.vmdk -d thin.
If you really want to understand this - provide an example where you use the vmkfstools -p 0 name-flat.vmdk > result.txt function
I had been away for a few days...
In regards to the "vmkfstools -p 0 name-flat.vmdk > result.txt" function, I've checked and I do not see any *.flat.vmdk files for any of the VMs in question.
There is a kb for this, and unless its a specific setup, you need to do it manually.
To reclaim the unused space of a virtual disk in ESXi/ESX 4.1 or later:
Note: Where vmkfstools supports the -K option (--punchzero), you can reclaim the zeroed blocks of thin-provisioned virtual disks without the need to clone to another VMFS datastore with a different block size.
SDeletecommand (or a tool with similar functionality) to zero out all unused space. The syntax for the SDelete command is SDelete -z driveletter. If you use
SDelete, ensure that you use version 1.6 or later.
vmkfstools -K /path/to/disk-name.vmdk