VMware Solutions Discussions

How to identify NetApp LUN ID in Vmware ?

meetrituraj
60,212 Views

Hi,

I have allocated couple of NetApp LUNs from different filer to a Vmware host ? Now how do I identify NetApp LUN IDs along with their Filer name or serial number ?

Thanks

Raj

1 ACCEPTED SOLUTION

georgevj
35,154 Views

Amrutha,

Welcome to the community.

These commands are not part of VMware powerCLI.

You should import Data ONTAP modules to your windows PowerShell instance to start using them. Here is a doc that will help you get started https://www.netapp.com/us/media/tr-4161.pdf

 

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.
Cannot find the answer you need? No need to open a support case - just CHAT and we’ll handle it for you.

View solution in original post

14 REPLIES 14

mcondon
60,168 Views

on esx host, go to configuration tab, storage adapters, then highlight the vmhba (fc or iscsi) that the lun is on.  Change from "devices" tab to "paths" tab...scroll to target.  There, you will find the  system id of the netapp filer.

sysadmin_hmgcc
60,168 Views

lun show -m

from the command line will show you all LUN ID's

Hope this helps.

plumcreek
60,169 Views

Responding to an old question but in the event this will help someone else searching.  To positively know that a particular NetApp mapped LUN is the same ESXi storage device:

TL:DR version is the VMware LUN identifier is the hex of the NetApp LUN Serial No. string.

  1. In vSphere, select the host configuration tab, storage.
  2. Select the Devices View   
  3. Sort by LUN # and locate the LUN you want to verify.
  4. Right click the LUN in the Devices list and select "Copy identifier to clipboard"
  5. Paste the copied identifier into a Hex to String converter
    1. http://www.string-functions.com/hex-string.aspx
  6. Copy the converted string and paste to a work note.
  7. In the NetApp System manager, select the LUN you want to verify in the LUN list.
  8. In the LUN properties pane, copy the Serial No.
  9. Paste Serial No. below the converted hex in the work note and compare.  There may be some odd ASCII characters at the beginning of the converted hex that you can ignore.

Note an alternate method to get the NetApp LUN Serial No value is in the CLI.  Use: lun show -v

MIKEF0209
60,170 Views

This worked perfectly for me.  I was able to find the serial and with the -v switch determine the serial of the LUN and match them

Thanks

R7IMPLANTACAO
60,170 Views

You can use lun serial -x <lun_path>. With -x serial number is printed in HEX format.

srkolusu
55,584 Views

Can you please tell me the equivalent command in C-mode.

asulliva
55,577 Views

Here is a PowerShell script I created which connects to both the VMware environment and the cDOT controller and reports on which NetApp LUNs back the datastore

 

Add-PSSnapin vmware.vimautomation.core
Import-Module DataONTAP

Connect-VIServer your.vcenter
Connect-NcController your.cdot.system

$naluns = Get-NcLun
$ds = Get-Datastore | ?{ $_.Type -eq "VMFS" }

$ds | %{
    Write-Host "Finding LUNs for datastore $($_.Name)" 
    $luns = $_ | Get-ScsiLun | ?{ $_.CanonicalName -match "naa.600a0980*" }

    if ($luns.length -gt 0) {
        Write-Host "    Found $($luns.length) paths"
        $completed = @()

        $luns | %{ 
            if (!$completed.Contains($_.CanonicalName)) {
                $hexSerial = ($_.CanonicalName).Substring(12)
                $serial = for ($i = 0; $i -lt $hexSerial.length; $i += 2) {
                    [char][int]::Parse($hexSerial.substring($i,2), 'HexNumber')
                }

                $ntapSerial = $serial -join ""
                Write-Host "  NetApp LUN serial is: $($ntapSerial)"

                $ntapLun = $naluns | ?{ $_.SerialNumber -eq $ntapSerial }
                Write-Host "    NetApp SVM: $($ntapLun.Vserver)"
                Write-Host "    LUN Path: $($ntapLun.Path)"
                $completed += $_.CanonicalName
            }
        }
    }
}

Sample output:

 

Finding LUNs for datastore GOLD
    Found 2 paths
  NetApp LUN serial is: T0ecH>0P3ekw
    NetApp SVM: VMware_SVM
    LUN Path: /vol/vmware_gold/vmware_gold.lun

Finding LUNs for datastore SILVER
    Found 2 paths
  NetApp LUN serial is: MT-gv?E8Ec5t
    NetApp SVM: VMware_SVM
    LUN Path: /vol/vmware_silver/vmware_silver.lun

Hope that helps.

 

Andrew

If this post resolved your issue, please help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

Amruthav
35,118 Views

 Hi,

 

Iam quite new to PowerCLI . On executing your script inside vmware power CLI . I get the following.

1. No snapins registered  fro powershell version 3.

 2. Data ontap module not found in any module directory.

 

I get the error but could you please give me the exact workaround that needs to be setup or installed to run the such scripts successfully?.

 

Thanks,

Amrutha

Amruthav
35,114 Views

Hi,

 

Could please tell me which environment did you excute this script . I executed it in vmware PowerCLI. But got some obvious erros like "Connect-NcController not a cmdlet". Where should the DataOntap module exist?

 

georgevj
35,155 Views

Amrutha,

Welcome to the community.

These commands are not part of VMware powerCLI.

You should import Data ONTAP modules to your windows PowerShell instance to start using them. Here is a doc that will help you get started https://www.netapp.com/us/media/tr-4161.pdf

 

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.
Cannot find the answer you need? No need to open a support case - just CHAT and we’ll handle it for you.

Amruthav
35,053 Views

Hi,

 

Right now iam able to write a PowerShell script where I can get the corresponding datastore name and device name (naa*) of a particular VM in Vsphere. But I want to know how to get the corresponding LUN id and the Target (iqn .*) . without uisng the Data Ontap modules( Guess this isnt required to get the above attributes).

 

Thanks,

Amrutha

macartm
24,287 Views

That Powershell is neat but it has one problem.

Netapp LUN serials are case-sensitive, but the comparison used is case-insensitive. I wondered why I had more LUNs than expected ... 

SO that should be "$ntapLun = $naluns | ?{ $_.SerialNumber -ceq $ntapSerial }"

pwolf
53,936 Views

That command would be 'lun show -fields serial' to show the serial number for all LUNs.  

 

You can filter it down by vserver by doing 'lun show -vserver [vserver name] -fields serial' or by specific LUN using 'lun show -lun [lun name] -fields serial'

 

-prw

georgevj
52,871 Views

https://www.youtube.com/watch?v=NGpe27Xp1nQ

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.
Cannot find the answer you need? No need to open a support case - just CHAT and we’ll handle it for you.
Public