VMware PowerCLI

VMware PowerCLI Add Harddisk and Attach to Paravirtual Controller

The VMware web client can be painful. In thinking about performance, lets see how to use 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 a 7-time VMware vExpert, with over two decades of experience in Information Technology. Having worked for numerous Fortune 500 companies as well as in various industries, He 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. Also, he goes through the effort of testing and troubleshooting issues, so you don't have to.

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.