VMware Cloud Community
satishh
Contributor
Contributor

How to get the lun path from device name

Hi,

I create a scsi lun and scan All HBAs. Vcenter will discover the lun and displays its canonical name (e.g. /vmfs/devices/disks/naa.60a98000433469752f6f5641654d4368 ) . Is there any way i can get the original lun name or lun path ?

Reply
0 Kudos
10 Replies
satishh
Contributor
Contributor

To continue the question, Is there a way we can form canonical name for the scsi Lun based upon any standards ?

Reply
0 Kudos
jkumhar75
Hot Shot
Hot Shot

Hey, Try the below command from service console

esxcfg-rescan -d vmhba<x> (where X is the adapter number, usually for iscsi its 32)

Jay

VCP 310,VCP 410,MCSE

Consider awarding points for "helpful" and/or "correct" answers.

If you found this or other information useful, please consider awarding points for "Correct" or "Helpful". Jayprakash VCP3,VCP4,MCSE 2003 http://kb.vmware.com/
Reply
0 Kudos
LucD
Leadership
Leadership

I'm not sure I understand what you mean by "lun path".

Is that a field that is displayed in the vSphere client ?

____________

Blog: LucD notes

Twitter: lucd22


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

Reply
0 Kudos
satishh
Contributor
Contributor

Hi,

I create a lun on SAN storage. when I rescan HBAs from Vcenter I get the device name for the lun in the Vcenter.

My question is How do I get the original lun path(in SAN storage) from the device name displayed in the Vcenter ?

Reply
0 Kudos
LucD
Leadership
Leadership

Still not sure what exactly you want.

Do you see the information you're after in the vSphere client ?

If yes, could you perhaps include a screenshot of the properties you want to see ?

____________

Blog: LucD notes

Twitter: lucd22


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

Reply
0 Kudos
Mohammad1982
Hot Shot
Hot Shot

If I understand you question correctly, you want to see the LUN from command line

use the following command.

#esxcfg-mpath -l | less

This will give you the LUN path information with "naa." id

If you found this information useful, please consider awarding points for "Correct" or "Helpful". Thanks!!! Regards, Mohammad Wasim
Reply
0 Kudos
LucD
Leadership
Leadership

If that is indeed what is being asked, then you have a PowerCLI solution as well.

$esxName = <esx-hostname>

$report = @()
$esx = Get-VMHost $esxName | Get-View

$esx.Config.StorageDevice.ScsiLun | where {$_.DeviceType -eq "disk"} | %{
	$row = "" | Select DeviceName, CanonicalName
	$row.DeviceName = $_.DeviceName
	$row.CanonicalName = $_.CanonicalName
	$report += $row
}
$report

____________

Blog: LucD notes

Twitter: lucd22


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

Reply
0 Kudos
satishh
Contributor
Contributor

Thanks guys for the solution.

This solves my problem.

-Satish.

Reply
0 Kudos
yboychev
Hot Shot
Hot Shot

Hi all,

Since I've seen other similar questions being redirected to this post I would like to make clarification that Luc's solution is correct as always but in this case is not optimal either from performance and mostly ease of use (Sorry Luc, but should have mentioned that). The same result could be achieved with a single line of PowerCLI code:

Get-ScsiLun -VmHost $esxName -LunType "disk" | Select CanonicalName, ConsoleDeviceName.

It's much shorter and easy to remember and on the other hand skipping a heavy unnecessary call to Get-View

Best regards,

Yavor

Reply
0 Kudos
LucD
Leadership
Leadership

Thanks Yavor, you're right.

Problem is just that the Get-ScsiLun doesn't return all the properties, for example the LUN Id is missing.

____________

Blog: LucD notes

Twitter: lucd22


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

Reply
0 Kudos