VMware PowerCLI

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

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

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.

Subscribe to VirtualizationHowto via Email 🔔

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Brandon Lee

Brandon Lee is the Senior Writer, Engineer and owner at Virtualizationhowto.com and has over two decades of experience in Information Technology. Having worked for numerous Fortune 500 companies as well as in various industries, Brandon has extensive experience in various IT segments and is a strong advocate for open source technologies. Brandon holds many industry certifications, loves the outdoors and spending time with family.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.