VMware PowerCLI Add Harddisk and Attach to Paravirtual Controller

There are certainly performance benefits to using the VMware ParaVirtual controller, especially in extreme load conditions.  According to VMware’s own documentation, the PVSCSI controller provides 8% better throughput at 10% lower CPU cost.  There are also performance benefits to use multiple SCSI controllers for your hard drives.  The principle is the same as with physical servers – the more disk controllers you have to spread out the load, the more throughput you will achieve.  For the best performance for high disk I/O VMs, we can use multiple PVSCSI controllers to power multiple VM hard disks.  As most know, it is a pain to add multiple hard disks and SCSI controllers of any type in the VMware web client.  Let’s take a quick look at how to use VMware PowerCLI Add Harddisk and Attach to Paravirtual Controller.

VMware PowerCLI Add Harddisk and Attach to Paravirtual Controller

Adding multiple hardware devices to a VM is very cumbersome in the web client.  The point and click menus are inconvenient at best.
addpvscsi01 VMware PowerCLI Add Harddisk and Attach to Paravirtual Controller
In steps PowerCLI.  With PowerCLI, we can easily add multiple hard drives attached to multiple SCSI controllers.  The below commandlet gets a particular VM using the Get-VM commandlet and then pipes this to the New-HardDisk commandlet and then finally to the New-ScsiController commandlet.  The command attaches each hard disk to an exclusive controller which is what we want for best performance.
Get-VM <yourvm> | New-HardDisk -CapacityGB 300 | New-ScsiController -Type ParaVirtual 
Get-VM <yourvm> | New-HardDisk -CapacityGB 500 | New-ScsiController -Type ParaVirtual 
Get-VM <yourvm> | New-HardDisk -CapacityGB 500 | New-ScsiController -Type ParaVirtual

We could even use a simple for loop to add multiple hard drives with SCSI controllers to each VM in a list.
$vms = Get-Content c:\vms.txt 
foreach ($vm in $vms){ 
Get-VM $vm | New-HardDisk -CapacityGB 300 | New-ScsiController -Type ParaVirtual 
Get-VM $vm | New-HardDisk -CapacityGB 500 | New-ScsiController -Type ParaVirtual 
Get-VM $vm | New-HardDisk -CapacityGB 500 | New-ScsiController -Type ParaVirtual 
}

Running the PowerCLI script will loop through and add the hard disks to the list of VMs you have in the text file.  This is a super easy way to mass add harddisks and SCSI controllers to multiple VMs.
addpvscsi02 VMware PowerCLI Add Harddisk and Attach to Paravirtual Controller

Thoughts

Thinking about multiple harddisk performance in VMware is critical on high I/O VMs.  ParaVirtual SCSI controllers can achieve greater throughput at a lower CPU cost which is highly desirable.  Using PowerCLI, we can mass add multiple harddisks and SCSI controllers to many VMs easily.  This is a much better way to add hardware than using the web client.  Hopefully this look at how to use VMware PowerCLI Add Harddisk and Attach to Paravirtual Controller.

Post a Comment

0 Comments