VMware Cloud Community
TheVMinator
Expert
Expert
Jump to solution

Meaning of usedspaceGB

I'm running this basic command but not getting what I need:

PowerCLI C:\> get-vm vmlax002 | select name, provisionedspacegb, usedspacegb

what i get is 100GB for both provisionedspacegb and usedspaceGB

However, inside the OS, Windows actually sees that although it is a 100GB virtual disk, there is still 50GB of free space.

The virtual machine is think provisioned. 

How can I get just the used space as it is seen from the oS perspective?

Thanks!

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Check if the harddisks on that VM are really Thin Provisioned

Get-VM vmlax002 | Get-HardDisk | Select Name,StorageFormat,CapacityGB



The UsedSpaceGB you are looking at is what vSphere sees.

For a Thick harddisks the ProvisionedSpaceGB and the UsedSpaceGB are the same.

vSphere has not clue how much space the partition in the guest OS is actually using.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
5 Replies
LucD
Leadership
Leadership
Jump to solution

Check if the harddisks on that VM are really Thin Provisioned

Get-VM vmlax002 | Get-HardDisk | Select Name,StorageFormat,CapacityGB



The UsedSpaceGB you are looking at is what vSphere sees.

For a Thick harddisks the ProvisionedSpaceGB and the UsedSpaceGB are the same.

vSphere has not clue how much space the partition in the guest OS is actually using.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
TheVMinator
Expert
Expert
Jump to solution

OK thanks - much appreciated.  What I need to do is figure out how much space would we used after I convert a bunch of VMs from thick to thin.  I was hoping I could use "used space" to do this but I can't.  Is there any other way you can think of to do this?

Thanks!

0 Kudos
LucD
Leadership
Leadership
Jump to solution

You can query inside the guest OS what is actually used on each harddisk.

Fro a Windows guest OS you could use something like this (through the Invoke-VMScript cmdlet).

Get-WmiObject win32_logicaldisk | select DeviceId,Size,FreeSpace

For a Linux guest OS, you might want to run a 'du' command.

The problem might be to map the guest OS partitions to the vSphere harddisks.

There have been some claims lately that there is such a method, but in my experience, these methods only work in specific situations.

And definitely not in all situations.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

TheVMinator
Expert
Expert
Jump to solution

OK thanks again.  In my case, it's OK if I can't map the individual guest partitions vmdks.  My overall goal is to see the total used space for all guest partitions of a single thick-provisioned VM.   Can this be done somehow by doing a get-vm and then getting guest.disks or .hardisk somehow?

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Yes, you can.

Something like this for example

foreach($vm in Get-VM | Get-VMGuest){

    $vm.Disks |

    Select @{N='VM';E={$vm.VMName}},Path,CapacityGB,FreeSpaceGB

}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos