Find space consumed by a Thin Provisioned vmdk

Here’s some fun commands to get some stats on Thin provisioned disks.

To find out the actual space consumed on disk (in GB):

stat <filename-flat>.vmdk | grep Size: | awk '{print (($4*512)/(1024*1024*1024))}'

To find out the total space provisioned (in GB):

stat <filename-flat>.vmdk | grep Size: | awk '{print ($2/(1024*1024*1024))}'

Percent not used:

stat <filename-flat>.vmdk | grep Size: | awk '{print ((($2/(1024*1024*1024))-($4*512)/(1024*1024*1024))/($2/(1024*1024*1024)))*100}'



2 Comments

You can convert 512 byte blocks to kilobytes by dividing them by 2
so the operation can be shortened to
awk ‘{print (($4)/(2*1024*1024))}’

Just for horror 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

*