Vinsane
Contributor
Contributor

VM Disk Layout and Guest Disk Size

Jump to solution

Hi All,

I could greatly use some assistance, I am looking to pull a report via PowerCLI with the following information, this would be an example. I'd like output for the VM, all drives, their associated datastores, disk layout type, the amount of storage allocated to that vmdk, the amount of disk the guest is actually using.

VM NameDriveDatastoreDisk LayoutStorage Allocated (GB)Guest Disk Usage (GB)
TEST01C:T1-DS-001THIN10040.5
TEST01😧T1-DS-002THICK400101.3

Thank you so much in advance!

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership

That information is coming from inside the guest OS.

In fact you need to have the VMware Tools installed to get that information.

The guest OS has not notion of the underlying vDisks, and hence the datastore.

In specific case, for example 1 partition on 1 vDisk, you can do this.

See for example Arnim's post called PowerCLI: Match VM and Windows harddisks – Part 2


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

View solution in original post

0 Kudos
3 Replies
LucD
Leadership
Leadership

I'm afraid there is no fool-proof method to link the partitions defined in the guest OS to the VMDKs.

One difficulty is for example a VMDK on which, in the guest OS, 2 partitions are created.


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

0 Kudos
Vinsane
Contributor
Contributor

Thanks for the quick reply, I did find this

ForEach ($VM in Get-VM ){($VM.Extensiondata.Guest.Disk | Select @{N="Name";E={$VM.Name}},DiskPath, @{N="Capacity(MB)";E={[math]::Round($_.Capacity/ 1MB)}}, @{N="Free Space(MB)";E={[math]::Round($_.FreeSpace / 1MB)}}, @{N="Free Space %";E={[math]::Round(((100* ($_.FreeSpace))/ ($_.Capacity)),0)}})}


I was looking to take it one step further and add the datastore for each drive output.

0 Kudos
LucD
Leadership
Leadership

That information is coming from inside the guest OS.

In fact you need to have the VMware Tools installed to get that information.

The guest OS has not notion of the underlying vDisks, and hence the datastore.

In specific case, for example 1 partition on 1 vDisk, you can do this.

See for example Arnim's post called PowerCLI: Match VM and Windows harddisks – Part 2


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

View solution in original post

0 Kudos