I have a number of thin-provisioned VMDKs. I would like to determine how much physical space they are using on the disk. A directory listing shows the allocated size of the virtual disk, but I need to figure out how to calculate raw.
Thanks in advance!
Take a look at the descriptor file (the short vmdk file)
It looks similar to the following
\# Disk DescriptorFile
version=1
CID=8a3484ef
parentCID=ffffffff
createType="vmfs"
\# Extent description
RW 8388608 VMFS "bwdevel-flat.vmdk"
\# The Disk Data Base
#DDB
ddb.toolsVersion = "6531"
ddb.virtualHWVersion = "4"
ddb.geometry.cylinders = "522"
ddb.geometry.heads = "255"
ddb.geometry.sectors = "63"
ddb.adapterType = "lsilogic"
You can calculate the size using the following formula
The number following RW * 512
This is precisely the reason you don't use Thin disks. This is also why it's a performance problem when you don't use thick disks. The space is allocated as the file grows, so if you have a bunch of thin disks, they will all grow to their full size eventually (as they get full) and then you could run out of space.
Why are you even using thin disks to begin with? Thin disks are not supported, and they become a headache to manage.
Thanks oreeh. The descriptor file shows the total provisioned disk size, not the actual space used. This is the same information yielded by vmkfstools -g "vmdk file". Your formula is correct for determining the disk size as the VM sees it.
Here is the vmdk for a server with a 20GB virtual disk. Only about 5GB are actually used.
\# Disk DescriptorFile
version=1
CID=93d5c337
parentCID=ffffffff
createType="vmfs"
\# Extent description
RW 41943040 VMFS "M-win2k3r2x64-flat.vmdk"
\# The Disk Data Base
#DDB
ddb.toolsVersion = "7201"
ddb.virtualHWVersion = "4"
ddb.geometry.cylinders = "2610"
ddb.geometry.heads = "255"
ddb.geometry.sectors = "63"
ddb.adapterType = "lsilogic"
ddb.thinProvisioned = "1"
I know that the actual physical storage space can be determined as it is displayed if I migrate from one storage pool to another. My quest is to find out how.
I take it that you aren't a fan of thin disks
Unless I am very badly mistaken, thin disks are supported. I would be interested in documentation to the contrary.
Thin provisioning allows one to virtualize storage in much the same way as network, CPU, memory, etc. are virtualized. "The running out of space" argument could be used against any one of the preceding subsystems. It is only with regular monitoring that anyone can ensure that enough capacity exists.
Thin provisioning is a very powerful tool and I think you will begin to see more options for it in subsequent releases of VC. In any case, I don't want to start a "Thin provisioning bad" thread. I just need a little assistance in solving a specific problem.
Thanks for the post.
So you want to know how much space is actually used from the VM?
It doesn't matter if its thin or thick then.
To see this in the VI client take a look here http://www.run-virtual.com/?page_id=145
BTW: we should probably speak of sparse disks instead of thin
Message was edited by:
oreeh
Sparse disks are different for Thin disks
Sparse are split into 2Gb and thin is the same but one big vmdk not split.
Message was edited by:
kevingj
I realize this is a bit late, but a NetApp buddy suggested that I try using the "du" command from the console. This does indeed work and shows the physical space utilization. Using the "-h" option will probably make more sense for most. "ls" will still show the allocated space. It would be interesting to create an add-in for VC to show the relative disk space.
Thanks to everyone for their comments.
So you want to know how much space is actually used
from the VM?
It doesn't matter if its thin or thick then.
To see this in the VI client take a look here
This is potentially lethal advice, if it is used to calculate how overcommitted your VMFS is.
The tool above reports on how much space the guest sees as being in use.
Inside the guest, if you create a 100MB file and delete it, there's no net effect on percent-used.
But from the outside, the thin .vmdk file will grow roughly 100MB. You don't get that space back (until the guest reuses those same sectors).
That's why VMware Workstation provides you with the ability to (with VMware Tools in a Windows guest) flag empty sectors before shrinking the disk.
Thankfully, there \*is* an easy way to tell how much space is actually consumed by a thin .vmdk. As someone else pointed out, the "du" command gets it right.
So, you can use du -ah or du -h *.vmdk
You can even use stat, like stat -c "%n: %b" *.vmdk
(that gives you the # of 512-byte blocks. Divide by 2048 to get megabytes, etc.)
Obviously, "du" is fine for the job. I only point out that you can use "stat" to make you aware that these thinly-provisioned VMFS files are indeed sparse files to the OS, and any tool using the stat() function can determine the number of blocks in use.
Regards,
Troy