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.
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.
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.