Highlighted
Expert
Expert

How to get a list of hard disks in ESXi host system ?

I am wondering if it is possible to get a list of hard disks that are in the server running esxi through either CIM or PowerCLI, is that doable ?  I was browsing CIM classes but could not find anything that would relate to local disks. Vsphere client on the other hand in the Hardware Status panel, is listing disks and the controller.

--- @blog https://grzegorzkulikowski.info
0 Kudos
9 Replies
Highlighted
Contributor
Contributor

Check this page: Hardware Monitoring in ESXi - Support Insider - VMware Blogs

You need install management tools provided by your hardware vendor.

0 Kudos
Highlighted
Enthusiast
Enthusiast

Hi

Syntax

Get-HardDisk [-Path <DatastoreItem[]>] [-DiskType <DiskType[]>] [-Server <VIServer[]>] [<CommonParameters>]

Get-HardDisk -Datastore <Datastore[]> [-DatastorePath <String[]>] [-DiskType <DiskType[]>] [-Server <VIServer[]>] [<CommonParameters>]

Get-HardDisk [-DiskType <DiskType[]>] [[-VM] <VirtualMachine[]>] [[-Template] <Template[]>] [[-Snapshot] <Snapshot[]>] [-Server <VIServer[]>] [<CommonParameters>

Thanks Sakthivel R
0 Kudos
Highlighted
Expert
Expert

This cmdlet is not for checking physical disks inside esxi...

--- @blog https://grzegorzkulikowski.info
0 Kudos
Highlighted
Expert
Expert

How does this help me to get the list of the physical hard disks inside the esxi ? Like i have mentioned, i can see those disks by checking the hardware status tab, they are there, but i need a scripted method to get this data.

--- @blog https://grzegorzkulikowski.info
0 Kudos
Highlighted
Contributor
Contributor

I'm going to assume you're talking about local drives mounted to the ESXi host. Connect to the target vCenter(s) and run this line.

get-view -ViewType datastore | select name, @{N="Local Drive?";E={!$_.summary.multiplehostaccess}}

Let me know how this works out.

0 Kudos
Highlighted
Enthusiast
Enthusiast

You can also use get-scsilun ​cmdlet.

0 Kudos
Highlighted
Expert
Expert

that is checking local datastore, what i need to have is info about the real physical disks in esxi, regardles if there is a datastore build on them or not.

--- @blog https://grzegorzkulikowski.info
0 Kudos
Highlighted
Expert
Expert

Hi,

  with this i can get info about the virtual disk that was built on raid controller, so basically it shows that i have 1 disk 136 GB, where in reality i have inside 2 disks , on top of which i have raid 1 mirror on them. which is 136, I am looking for this information:

Untitled.png

--- @blog https://grzegorzkulikowski.info
0 Kudos
Highlighted
Expert
Expert

Ok i have figured out 1 way of doing this for HP blades that i have:

$esxi = 'myhost'

$CIMOpt = New-CimSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck -Encoding Utf8 –UseSsl

$Session = New-CimSession -Authentication Basic -Credential $cred -ComputerName $esxi -port 443 -SessionOption $CIMOpt

Get-CimInstance  -CimSession $Session -Namespace 'root/cimv2' -ClassName 'CIM_StorageExtent' | ?{$_.CreationClassName -eq 'HPVC_SAStorageExtent'} | Select PSComputerName, Caption, ElementName

In return i get this:

PSComputerName        Caption                                 ElementName

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

esxi01.local.lan             Disk 1 on HPSA1                  Disk 1 on HPSA1 : Port 1I Box 1 Bay 1 : 136GB : Data Disk

esxi02.local.lan             Disk 2 on HPSA1                  Disk 2 on HPSA1 : Port 1I Box 1 Bay 2 : 136GB : Data Disk

So far i got nothing better than this, so this has to do the trick Smiley Wink

--- @blog https://grzegorzkulikowski.info
0 Kudos