Storage PowerCLI One-Liners: Difference between revisions

From vwiki
Jump to navigation Jump to search
(Initial creation - content from PowerCLI One-Liners page)
 
m (→‎Set LUN Multipathing: Linked to RR IOPS)
 
Line 30: Line 30:
The above came from Troy Clavell's post to be found at http://communities.vmware.com/thread/339480
The above came from Troy Clavell's post to be found at http://communities.vmware.com/thread/339480


Note that you should also set the IOPS per path to 1 (default is 1000), there is some debate as to whether you should do this or not, HP recommend it for their SAN's, though some worry about the overhead on the ESX caused by switching paths for every IO.  The choice is yours, though for further reading and how to do it...
Note that some SAN vendors recommend that you should also set the IOPS per path to 1 (default is 1000), there is some debate as to whether you should do this or not, HP recommend it for their SAN's, though some worry about the overhead on the ESX caused by switching paths for every IO.  The choice is yours, though for further reading...
* [[Configuration_Considerations_(ESX)#Round_Robin_IOPS_Load_Balancing|Round Robin IOPS Load Balancing]]
* http://h20195.www2.hp.com/V2/GetDocument.aspx?docname=4AA1-2185ENW&cc=us&lc=en - HP's best practice
* http://h20195.www2.hp.com/V2/GetDocument.aspx?docname=4AA1-2185ENW&cc=us&lc=en - HP's best practice
* http://www.yellow-bricks.com/2010/03/30/whats-the-point-of-setting-iops1/
 


[[Category:PowerCLI]]
[[Category:PowerCLI]]
[[Category:Storage]]
[[Category:Storage]]

Latest revision as of 14:34, 13 March 2012

Get VMDKs

Get the virtual HD (VMDK) details for a particular VM

 Get-VM -Name "MyVM" | Get-HardDisk | Format-List

Get the VMDK details for a particular VM (as seen from within guest OS)

 (Get-VM -name "MyVM" | Get-VMGuest).Disks

Get the VMDK details for all VM’s in a folder (sorted by VMDK path)

 Get-VM -Location (Get-Folder -Name "MyFolder") | Get-HardDisk | sort-object -Property Filename

List VM RDMs

List VM Raw Device Mapping (RDM) disks

 Get-VM | Get-HardDisk -DiskType "RawPhysical","RawVirtual" | Select Parent,Name,CapacityKB,Filename,ScsiCanonicalName,DeviceName

Create PowerShell drive

Create a PowerShell drive for the MyDatastore datastore

 New-PSDrive -Name DS -PSProvider ViMdatastore -Root '\' -location (Get-Datastore MyDatastore)

Upload file to datastore

Upload file to datastore (a PowerShell drive needs to be create 1st - see above)

 Copy-DatastoreItem C:\Temp\FileToUpload.vmdk -Destination DS:\VMFolder\

List LUN Multipathing

List all disk multipathing

 Get-VMHost | Get-ScsiLun | Select VMHost,Vendor,Model,LunType,CapacityMB,RuntimeName,MultipathPolicy,CanonicalName | Export-Csv lunpath.csv

Set LUN Multipathing

Set all SCSI disks to use round robin multipathing

 Get-VMHost | Get-ScsiLun -LunType disk |  Set-ScsiLun -MultipathPolicy "roundrobin"

The above came from Troy Clavell's post to be found at http://communities.vmware.com/thread/339480

Note that some SAN vendors recommend that you should also set the IOPS per path to 1 (default is 1000), there is some debate as to whether you should do this or not, HP recommend it for their SAN's, though some worry about the overhead on the ESX caused by switching paths for every IO. The choice is yours, though for further reading...