Home VSphere Thin Provisioning Notes
Post
Cancel

VSphere Thin Provisioning Notes

VMware’s disk thin provisioning can be a useful thing, but it needs to be understood. Space can be consumed when files are added. If those files are deleted, the VM has to be stopped to reclaim the space.

source: https://kb.vmware.com/s/article/2136514

Example:

  • VM with a 250 GB thin provisioned disk.
  • Install Ubuntu v22
  • Takes 8 GB of storage

Testing phase

VM: Add a 200 GB file containing zeros:

1
dd if=/dev/zero of=sample.txt bs=1G count=200 # 200GB
  • Takes 8 GB of storage - Zeros take no space!

VM: Add a 200 GB file containing random characters:

1
dd if=/dev/urandom of=sample.txt bs=1G count=200 # 200GB
  • Takes 225 GB of storage.

VM: Delete the 200 GB junk file.

  • Space is not reclaimed.

Host: Try to reclaim the free space from the host:

1
vmkfstools -K Test-Large/Test-Large.vmdk
  • Now takes 210 GB of storage.

This kinda works

VM: Add a 200 GB file containing zeros which creates a large contiguous section of zeros:

1
2
dd if=/dev/zero of=zeroes && rm -f zeroes # Fills up the drive completely and deletes the file
sudo poweroff

Host: Try to reclaim the free space from the host:

1
vmkfstools -K Test-Large/Test-Large.vmdk
  • Now takes 185 GB of storage. Not a big improvement.

This does work

  1. Do a Storage vMotion to another datastore. Change the storage method to Thick.
  2. Then migrate the storage changing it to Thin provisioned.
    • Down to 3.75 GB of storage.
This post is licensed under CC BY 4.0 by the author.