VMware Cloud Community
gibsster
Enthusiast
Enthusiast
Jump to solution

How can I get the number of disks of a VM and the IOPs of a disk ?

Hi all,

I would like to know if there is any command that returns the number of disks that a VM has.

and also if there is any command to get and modify the number of IOPs of a disk.

Thanks in advance

Carlos

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
kunaludapi
Expert
Expert
Jump to solution

it will give you attached harddisks

Get-VM | Harddisk


it will give you count

get-vm | select name, @{N="TotalHDD"; E={($_ | Get-HardDisk).count }}


it is possible to retrieve number of IOPS of disk, but what do you mean by modifying it.

--------------------------------------------------------------- Kunal Udapi Sr. System Architect (Virtualization, Networking And Storage) http://vcloud-lab.com http://kunaludapi.blogspot.com VMWare vExpert 2014, 2015, 2016 If you found this or other information useful, please consider awarding points for "Correct" or "Helpful".

View solution in original post

0 Kudos
5 Replies
kunaludapi
Expert
Expert
Jump to solution

it will give you attached harddisks

Get-VM | Harddisk


it will give you count

get-vm | select name, @{N="TotalHDD"; E={($_ | Get-HardDisk).count }}


it is possible to retrieve number of IOPS of disk, but what do you mean by modifying it.

--------------------------------------------------------------- Kunal Udapi Sr. System Architect (Virtualization, Networking And Storage) http://vcloud-lab.com http://kunaludapi.blogspot.com VMWare vExpert 2014, 2015, 2016 If you found this or other information useful, please consider awarding points for "Correct" or "Helpful".
0 Kudos
gibsster
Enthusiast
Enthusiast
Jump to solution

Hi kunaludapi,

It didn't work the output doesn't show the number of disks that my three VMs have. Below you can see both the script and the output. The test.txt file has the name of my three VMs.

What I mean by modifying number of IOPs is the following. In Vcenter when you edit the settings of any VM, if you click on the tab Resources you will see "Disk" and if you click on it. you will see the Disks that VMs have and right there you can limit the number of IOPs.

I would like to create a script that modifies that number since I have like 300 VM running and would be much faster just running a scrip than doing it manually.

$file = "C:\Users\cperalta_labs\Desktop\test.txt"

$vms = Get-Content $file

Get-VM $vms | Harddisk

get-vm $vms | select name, @{N="TotalHDD"; E={($_ | Get-HardDisk).count }}

Output:

Name                                                                            TotalHDD                                                  

----                                                                                      --------                                              

cperalta (7e327337-51db-42d8-9cd8-c4...                                       

cperalta (94af0cca-4480-42e6-84a8-ca...                                       

cperalta-test (795ab623-0657-40f7-8f...                                       

0 Kudos
kunaludapi
Expert
Expert
Jump to solution

This is strange, no output on Get-VM | Get-Harddisk.

You can use below commands to get and set IOPS details on per vm

Get-VMResourceConfiguration

Set-VMResourceConfiguration

As I am assuming vms are deployed using vcloud director as there is UUID in the name.

If yes try loggging into vcloud director using Connect-CIServer and let me know what output do you see.

Get-CIVM | Get-CIVMHardDisk  

--------------------------------------------------------------- Kunal Udapi Sr. System Architect (Virtualization, Networking And Storage) http://vcloud-lab.com http://kunaludapi.blogspot.com VMWare vExpert 2014, 2015, 2016 If you found this or other information useful, please consider awarding points for "Correct" or "Helpful".
0 Kudos
gibsster
Enthusiast
Enthusiast
Jump to solution

Thank you  very much. I already made this command work... get-vm $vms | select name, @{N="TotalHDD"; E={($_ | Get-HardDisk).count }}

I have a question what do N and E mean ?? or where can I find a doc that explains that, do you know.

thanks again

0 Kudos
kunaludapi
Expert
Expert
Jump to solution

This is very basic and will help you.

Windows PowerShell Tip: Using Calculated Properties

--------------------------------------------------------------- Kunal Udapi Sr. System Architect (Virtualization, Networking And Storage) http://vcloud-lab.com http://kunaludapi.blogspot.com VMWare vExpert 2014, 2015, 2016 If you found this or other information useful, please consider awarding points for "Correct" or "Helpful".
0 Kudos