VMware Cloud Community
ganapa2000
Hot Shot
Hot Shot
Jump to solution

get status of volume

Hi,

I am able to get the datastore status. if it is attached and mounted on the esxi, but I have few volumes on which datastores are not created, how can i get the status of volume, if it is attached and mounted ?

Hereby attached by exisiting script. please help!!

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

The script doesn't return objects that have a Device property.

Replace $_.Device with $_.LUN.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos
8 Replies
LucD
Leadership
Leadership
Jump to solution

Have a look at LUN Report – Datastore, RDM And Node Visibility

It produces a report with all LUNs, on which ESXi nodes they are visible, and if they are used (datastore or RDM) or not.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
ganapa2000
Hot Shot
Hot Shot
Jump to solution

LucD,

I just need to get as below, please help...

pastedImage_0.png

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

You could do something like this, but it will only work for VMFS datastores (not for RDM, nor VSAN datastores).

Get-VMHost -PipelineVariable esx |

ForEach-Object -Process {

   $esxcli = Get-EsxCli -VMHost $esx -V2

   $devVMFS = $esxcli.storage.vmfs.extent.list.Invoke().DeviceName

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

   where{$_.DeviceType -eq 'Direct-Access'} |

  Select @{N='VMHost';E={$esx.Name}},

   @{N='LUN';E={$_.Device}},

   @{N='Attached';E={$_.IsOffline -eq 'false'}},

   @{N='Mounted';E={$devVMFS -contains $_.Device}}

}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
ganapa2000
Hot Shot
Hot Shot
Jump to solution

LucD, this list all devices on all hosts but I would like to know the status of particular naa or device on all the hosts.

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

You can filter that with a Where-clause


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
ganapa2000
Hot Shot
Hot Shot
Jump to solution

LucD,

I tried as below and not getting any output

Get-VMHost -PipelineVariable esx |

ForEach-Object -Process {

   $esxcli = Get-EsxCli -VMHost $esx -V2

   $devVMFS = $esxcli.storage.vmfs.extent.list.Invoke().DeviceName

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

   where{$_.DeviceType -eq 'Direct-Access'} |

  Select @{N='VMHost';E={$esx.Name}},

   @{N='LUN';E={$_.Device}},

   @{N='Attached';E={$_.IsOffline -eq 'false'}},

   @{N='Mounted';E={$devVMFS -contains $_.Device}}

} | where {$_.Device -eq "naa.6006016025903800934b3bf30f59e811"}

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

The script doesn't return objects that have a Device property.

Replace $_.Device with $_.LUN.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
ganapa2000
Hot Shot
Hot Shot
Jump to solution

Superb...Thanks you very much for your help Smiley Happy

Reply
0 Kudos