PowerCLI: Virtual Machine Disk (VMDK) info v2: Analyze data with Excel


In my previous post about this subject I created a script to view the information on the PowerCLI console. With the v2 script you are able to export the data to a CSV file.

$myCol = @()
$vms = get-view -ViewType VirtualMachine  | Where-Object `
{-not $_.config.template} 
foreach($vm in $vms){
    foreach($dev in $vm.config.hardware.Device){
    $MYInfo = "" | Select-Object VMName, DeviceLabel, `
    FileName, DiskMode, ThinProvisioned

       $MYInfo.VMName = $vm.Name

           if($dev.GetType().Name -eq "VirtualDisk"){
                   $MYInfo.DeviceLabel = $dev.DeviceInfo.Label
                $MYInfo.FileName = $dev.Backing.FileName
                $MYInfo.DiskMode = $dev.Backing.DiskMode
                $MYInfo.ThinProvisioned = "True"}
                else{$MYInfo.ThinProvisioned = "False"}

                $myCol += $MYInfo
$myCol | Export-CSV -NoTypeInformation "D:\scripts\vmdkinfo.csv"

When the script is finished, you can import the CSV file into Excel.  After the import, we can analyze the data with just a simple filter. With a few clicks,  you’re able to view al the VM’s without Thin Provisioned disks.


Now we have a list with all the VM’s with Thin Provisioned disks:


So with a small PowerCLI script and the help of Microsoft Excel, you’re able to generate a report with just the information you need. The best part is that it will only cost you couple of minutes of your time 🙂 .

PowerCLI: Virtual Machine Disk (VMDK) info


I was creating a small reporting script about the Virtual Machine disk. The things I wanted to report where the File Name (the location of the VMX file), the disk mode (Independent –> Persistent or nonPersistent) and if the disk is Thin Provisioned or not.  But then I thought why reinventing the wheel if Mr PowerCLI LucD has already created such a script. So I started a search on the VMware communities and found a post of @LucD22 which contains the Thin Provisioned “Check”. So I added the items I wanted to see and came to the following script:

get-view -ViewType VirtualMachine  | Where-Object `
{-not $_.config.template} | % {
Write-Host $_.Name -ForegroundColor Yellow
    foreach($dev in $_.config.hardware.Device){
        if($dev.GetType().Name -eq "VirtualDisk"){
            Write-Host "`t" $dev.DeviceInfo.Label = $dev.Backing.FileName
            Write-Host "`t" $dev.DeviceInfo.Label = $dev.Backing.DiskMode
            Write-Host "`t" $dev.DeviceInfo.Label = "Is Thin Provisioned" `
            -ForegroundColor Green}
            Write-Host "`t" $dev.DeviceInfo.Label = "Is NOT ThinProvisioned" `
            -ForegroundColor Red }

This is the output of the script:


VMware: VM Disk space calculator

This post is a copy from Cody Bunch his blogpost. Cody thanks for sharing!!!:

This is a tool that I created a while back to assist in sizing needed disk space in a deployment. Straight forward to use, the totals are calculated as follows: VMDK Size + Ram Size * 1.1 + 12Gb = Total Needed. While the VMDK may be obvious, the others are just as important. Ram Size is included, as ESX will create a swap file on the disk where the VM’s configuration resides (unless you specify otherwise) and needs to be included.  The * 1.1 is to add 10% to the overall solution, to allow for snapshots. This can likely be adjusted up or down depending on your specific requirements, but I’ve found that at least 10% works best.  The last number, 12GB. This one may seem like a mystery, and likely it is. This was originally included to allow for the ESX install on a local host, and some additional room for it’s related overhead.  If your VM’s are on SAN, this number can likely be left out, but… a little more overhead never hurt anyone.


Download link and source: http://professionalvmware.com/2008/12/08/virtual-machine-disk-sizing-tool/

VMware: Partition/disk aligned or not?


De Laatste weken zag ik het topic Partition/Disk Alignment verschillende malen langs komen. Ik maakte tot op heden nog geen gebruik van deze optie en wilde er nu wel eens het fijne van weten. VMware heeft een whitepaper gepubliseerd over dit onderwerp. Deze vind je hier:

Partition alignment is a known issue in physical file systems, and its remedy is well-documented. The goal of the testing reported in this paper was to validate the assumption that unaligned partitions also impose a penalty when the partition is a VMware Virtual Machine File System (VMware VMFS) partition.

This paper lists a summary of the results of our testing, recommendations for VMware VMFS partition alignment, and the steps needed to create aligned VMware VMFS partitions.


Nadat je de whitepaper hebt gelezen, wil je natuurlijk zelf ook wel eens kijken hoe dit in zijn werk gaat. Ik kwam een how to tegen, die geschreven is door Harley Stagner en gepost is op: http://searchvmware.techtarget.com/.

Voordat je door kunt gaan, heb je een pc of een VM nodig met daarop de Windows Automated Installation Kit (AIK) geïnstalleerd.

To install Windows AIK, you need to download the image from Microsoft, burn it to a DVD and install it. Once WindowsAIK is installed, go to Start, then Programs, then Windows AIK, then Windows PE Tools command prompt. Note: If you use Windows Vista, you have to right-click on the Windows PE Tools command prompt entry and select RunAs Administrator.

With the command prompt open, you need to run a command that will set up the directory structure needed to create your WinPE 2.0 disk. Run the following at the command prompt:

copype <arch> <destination>

Where <arch> is your processor architecture (x86, amd64, or ia64) and <destination> is a path to a local directory. Below is an example of running this command:

copype x86 c:\winpe-2_0 <enter>

copy c:\winpe\winpe.wim c:\winpe-2_0\iso\sources\boot.wim /y


The final step is the creation of the iso file. This can be done with the following command:

oscdimg -n -h -bc:\winpe-2_0\etfsboot.com c:\winpe-2_0\iso c:\winpe-2_0\winpe_diskpart.iso



Nu de iso klaar is, kunnen we een nieuwe VM opstarten met winpe_diskpart.iso


Run Diskpart:

select disk 0 (of een ander nummer, als je een andere disk wilt alignen)
create partition primary align=64


Via msinfo32 kun je de alignment nakijken.

How to tell if your disks are aligned
How can you tell if a disk is unaligned at the Windows partition level? Remember the MBR statement — that x86 systems use the first 63 sectors. Usually there are 512 bytes per sector. If you do the math, 63 x 512 = 32,256. To verify this, log into a machine (physical or virtual) as an administrator that has not had its system volume aligned. Go to Start, then Run, then type in "msinfo32.exe" and press enter. Navigate down to Components, then Storage, then Disks. Notice that the partition starting offset for Disk #0, Partition #0 (the system volume) is 32,256 bytes. This means that the disk is not aligned.

If the partition Starting Offset is 65.536 bytes, the disk is aligned.

Meer informatie over disk alignment vind je hier: http://blogs.netapp.com/storage_nuts_n_bolts/2009/01/mbrscanmbralign.html

Als je kunt inloggen op now.netapp.com/. Dan kun je hier de tool mbrscan downloaden. Via deze tool kun je vanaf het Service Console de Alignment nakijken. Netapp is ook bezig met een ander script genaamd mbralign. Via dit script kun je de alignment aanpassen zonder dataverlies.


Update: Rudolf  Kleijwegt poste de volgende reacite: In Windows 2008 is het niet meer nodig om de Windows Automated Installation Kit te gebruiken. Je kunt namelijk tijdens het installeren de toetsencombinatie SHIFT+F10 gebruiken om een command prompt te openen. Op dat moment heb je de beschikking over diskpart en kun je een uitgelijnde partitie aanmaken. Deze procedure gaat helaas niet op voor Windows 2003. Als je daar SHIFT+F10 gebruikt krijg je een recovery console met een uitgeklede diskpart.

VMware: Hot Add VMDK


In ESX 3.5 is het mogelijk een een VMDK live aan een VM te koppelen. Je hoeft dus niet eerst de VM down te gooien. Start de Add Hardware Wizard en voeg een nieuwe VMDK toe.


Nadat de VMDK is aangekoppeld open je binnen de VM de Computer Management mmc. Ga naar Storage – Disk Management. Voer een Rescan Disks uit.


De nieuwe VMDK wordt gevonden en kan worden gepartitioneerd.


Via deze manier kun je heel snel, extra storage toevoegen aan een VM.