VMware Cloud Community
Grzesiekk
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
Reply
0 Kudos
11 Replies
Ethernauta
Contributor
Contributor

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

You need install management tools provided by your hardware vendor.

Reply
0 Kudos
sakthivelramali
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
Reply
0 Kudos
Grzesiekk
Expert
Expert

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

--- @blog https://grzegorzkulikowski.info
Reply
0 Kudos
Grzesiekk
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
Reply
0 Kudos
amazingpudding
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.

Reply
0 Kudos
pkolom
Enthusiast
Enthusiast

You can also use get-scsilun ​cmdlet.

Reply
0 Kudos
Grzesiekk
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
Reply
0 Kudos
Grzesiekk
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
Reply
0 Kudos
Grzesiekk
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
Reply
0 Kudos
gdmersh
Enthusiast
Enthusiast

When I run get-scsilun , I get command not found.

When I run esxcfg-scsidevs -l , I only see the raid controller details. It does not show any disks underneath. I know I have 8 hdds of vendor "SEAGATE"

How can I see all the details of the disks like vendor, model, serial no, speed, interface etc...

Would really appreciate your response

Thank you

-Dee  

Reply
0 Kudos
Runnel
Contributor
Contributor

I know it is an old thread

But I have found a solution. 

You can list all devices whit the command Get-EsxCli

Example: 

$esxcli = Get-EsxCli -VMHost <HOSTNAME/IP> -V2

$esxcli.storage.core.device.list.Invoke()

 

 

Reply
0 Kudos