Automation

 View Only
  • 1.  Getting real size of VMDKs

    Posted Feb 02, 2011 08:25 AM

    I wrote a script with Powercli to get the sum of all VMDK files per Datastore.

    Tested it on my workstation (XP) with version 4.0.1.2164 of PowerCLI and it reported the real disk sizes (a disk of 40GB was reported as 40GB and not how much data really was allocated). Then I installed Powercli version 4.1.1.2816 on a Windows 2003 server to automate the script with a scheduled task, but then the script reported the disk sizes with how much they really used on the datastore. So my 40GB virtual disk now showed as 8,5GB instead of the full size.

    I got the virtual disk sizes in a loop with get-harddisk -datastore <datastorename> | select capacityKB

    I've also tried (get-vm $vm.name).harddisks, but that gave the same output.

    Searched all places, but I can't get it to work anymore on the new PowerCLI versions.

    Does anyone know how to get the full size of VMDK disks per Datastore ?



  • 2.  RE: Getting real size of VMDKs

    Posted Feb 02, 2011 09:02 AM

    Strange, the Harddisks property gives me the allocated disk size (for Thick and for Thin vdisks).

    The following gives the full disk size for me

    Get-VM -Name $vmName | Select -ExpandProperty Harddisks | ft -Autosize

    While this gives the used size of each each hard disk on a datastore

    Get-HardDisk -Datastore $dsName | ft -AutoSize


  • 3.  RE: Getting real size of VMDKs

    Posted Feb 02, 2011 09:17 AM

    Strange indeed, when I run the Get-VM -Name $vmName | Select -ExpandProperty Harddisks | ft -Autosize command, the output differs:

    From the Windows 2003 server:

    CapacityKB Persistence   Filename
    ---------- -----------   --------
    183808     Unknown       [DATASTORE] FOLDER/VM1.vmdk

    From the XP workstation:

    CapacityKB Persistence   Filename
    ---------- -----------   --------
    10485760   Unknown       [DATASTORE] FOLDER/VM1.vmdk



  • 4.  RE: Getting real size of VMDKs

    Broadcom Employee
    Posted Feb 02, 2011 10:33 AM

    Is the 2003 64bit?

    If yes, try running PowerCLI in 32bit mode



  • 5.  RE: Getting real size of VMDKs

    Posted Feb 02, 2011 12:13 PM

    It's a Windows 2003 32-bit Std Server and the workstation is also 32bit.

    But I honestly can't see what the OS version of the server has to do with this. The data it collects comes from Virtual Center.

    A colleague of mine has run the script from his workstation (same specs as mine), but with the same version of PowerCLI as the server and it collects the same data as the W2003 Server, not the data from my workstation.



  • 6.  RE: Getting real size of VMDKs

    Posted Feb 04, 2011 12:55 PM

    Installed 4.0.1.2164 on the server and it's collects the full disk sizes...