Online Expert Day - HPE Data Storage - Live Now
April 24/25 - Online Expert Day - HPE Data Storage - Live Now
Read more
System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Identify LUN ID with SCSIMGR

Torsten.
Acclaimed Contributor

Identify LUN ID with SCSIMGR

Dear all,

 

I currently have a server running 11.31 release version 11.03 with around 100 LUNs presented from EVA HSV300 (XCS 09534000) and P2000.

 

Now I try to find an easy way to identify the relation between persistant DSF and LUN ID.

 

I try

 

# scsimgr -p get_attr all_lun  -a lunid

 

but this delivers me around 100 empty lines on the screen.

 

The command

 

# scsimgr -p get_attr all_lun -a device_file -a lunid

delivers for example

 

/dev/rdisk/disk145:
/dev/rdisk/disk146:
...

 

there is the device file, but NO LUN ID.

 

 

A command like this

 

# scsimgr  get_attr -C lunpath -I 27 -a lunid

 

works and delivers

 

current =0x400f000000000000 (LUN # 15, Flat Space Addressing)

 

This is what I want to have, but I don't want to run the command for each path one by one, I want to have a command for all LUNs at once.

 

 

Any ideas?

 

 


Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
19 REPLIES
donna hofmeister
Trusted Contributor

Re: Identify LUN ID with SCSIMGR

the scsimgr manul shows this for displaying the hardware path, device file, WWID and serial number for all devices, in scriptable output:


# scsimgr -p get_attr all_lun -a hw_path -a device_file -a wwid -a serial_number
64000/0xfa00/0x0:/dev/rdisk/disk15:0x0004cffffebbf737:3FD1M2SW
64000/0xfa00/0x1:/dev/rdisk/disk16:0x0004cffffebbe43e:3FD1LZ0S
64000/0xfa00/0x2:/dev/rdisk/disk17::
64000/0xfa00/0x3:/dev/rdisk/disk18:0x20000020371972ee:LS255190000010080N0V
64000/0xfa00/0x4:/dev/rdisk/disk19:0x20000020371972e3:LS271211000010080N1H
64000/0xfa00/0x5:/dev/rdisk/disk20:0x20000020371972eb:LS24603100001008K74M
64000/0xfa00/0x6:/dev/rdisk/disk21:0x200000203726a3af:LJS87900000029491GWF
64000/0xfa00/0x7:/dev/rdisk/disk22:0x20000020370fe8c8:LJ67387800002916H9A9
64000/0xfa00/0x8:/dev/rdisk/disk23:0x200000203726d3b9:LJT4848400002950H0R4
64000/0xfa00/0x9:/dev/pt/pt2::USSO08016323
64000/0xfa00/0xa:/dev/pt/pt3::USSO08016323

 

does that help?

Torsten.
Acclaimed Contributor

Re: Identify LUN ID with SCSIMGR

I have read the manual up and down and NO, this does not help!

 

It gives the hw_path, the device file, the serial and the WWID, but not the LUN ID!

 

Matching the serial# or WWID to the device file is exactly what I don't want to do!


Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Robert_Jewell
Honored Contributor

Re: Identify LUN ID with SCSIMGR

What about simply:  # ioscan -m lun

 

For example:

 

disk     17  64000/0xfa00/0x11   esdisk  CLAIMED     DEVICE       online   DGC     CX3-20cWDR5
             0/4/2/0.0x5006016041e07841.0x4000000000000000
             0/5/1/0.0x5006016841e07841.0x4000000000000000
                      /dev/disk/disk17   /dev/rdisk/disk17
disk     18  64000/0xfa00/0x12   esdisk  CLAIMED     DEVICE       online   DGC     CX3-20cWDR5
             0/4/2/0.0x5006016041e07841.0x4001000000000000
             0/5/1/0.0x5006016841e07841.0x4001000000000000
                      /dev/disk/disk18   /dev/rdisk/disk18
disk     19  64000/0xfa00/0x13   esdisk  CLAIMED     DEVICE       online   DGC     CX3-20cWDR5
             0/4/2/0.0x5006016041e07841.0x4002000000000000
             0/5/1/0.0x5006016841e07841.0x4002000000000000
                      /dev/disk/disk19   /dev/rdisk/disk19


You get the LUNID as seen by the disk array and the psf.  What I dont know is if the format of the LUNID is consistent across storage vendors.  I only have the Clariion on 11.31 so I cant compare.

 

-Bob

----------------
Was this helpful? Like this post by giving me a thumbs up below!
Torsten.
Acclaimed Contributor

Re: Identify LUN ID with SCSIMGR

This is probably not a bad idea.

 

The first part is known (0/4/2/0), it's the path to the FC HBA.

 

The next part (0x5006016041e07841) identifies the array.

 

The last part (0x4001000000000000)identifies the LUN.

 

 

I found this:

 

"Since the LUN address is printed in hexadecimal, the first hexadecimal digit contains both the addressing method and the start of the LUN number. For example, the first 16 bits of the LUN address 0x400f000000000000 is binary 0100000000001111. The leading 01 is the addressing method (Flat Space Addressing) and the remaining bits represent the LUN number (15). Thus, the LUN address 0x400f000000000000 represents LUN number 15 using the Flat Space Addressing method."

 

So in this example (0x4001000000000000) it is LUN 1 (001hex) in Flat Space Addressing method (0x4).

 

 

 

 

 

The scsimgr promises to tell the LUN in decimal!

 

This would be great and simple, but it looks like it doesn't work.

 

Is it a problem of scsimgr or the array firmware?

 

Robert, if you could try the command above you could clarify this question.

 

# scsimgr -p get_attr all_lun -a device_file -a lunid

 

 


Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Robert_Jewell
Honored Contributor

Re: Identify LUN ID with SCSIMGR

I had the same results you did:

 

# scsimgr -p get_attr all_lun -a device_file -a lunid
/dev/rdisk/disk15:
/dev/rdisk/disk16:
...etc

 

# scsimgr -p get_attr all_lun -a lunid

 (blank lines for each LUN it appears)

-Bob

----------------
Was this helpful? Like this post by giving me a thumbs up below!
Duncan Edmonstone
Honored Contributor

Re: Identify LUN ID with SCSIMGR

Torsten,

 

I see the same thing too - yet something like:

 

#scsimgr -p get_attr all_lun -a device_file -a max_q_depth

 

or

 

#scsimgr -p get_attr all_lun -a device_file -a hw_path

 

works as expected... I can't see a reason why this shouldn't work - I'd be tempted to report that as a bug and see where you get


HTH

Duncan
Arunabha Banerjee
Valued Contributor

Re: Identify LUN ID with SCSIMGR

You can simply get the LUN ID executing following command.

 

I have attached a sample output.

 

# scsimgr lun_map | egrep '(disk|WWID)'

AB
Torsten.
Acclaimed Contributor

Re: Identify LUN ID with SCSIMGR

Sorry, this is NOT what I was looking for.

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Arunabha Banerjee
Valued Contributor

Re: Identify LUN ID with SCSIMGR

What about the below command ?

 

# scsimgr lun_map | egrep '(disk|Hardware path)'

 

Sample output attached

AB
Torsten.
Acclaimed Contributor

Re: Identify LUN ID with SCSIMGR

I don't have a problem to read some hex values, but other folks want to see the relation

 

/dev/disk/disk_xx == LUN xx

 

from the array in decimal, just as promised by scsimgr.

 

This is the root cause of the question.


Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
vijay alur alur
Frequent Advisor

Re: Identify LUN ID with SCSIMGR

hey, try this.....

 

write this in a file and execute it.

 

ioscan

insf

for i in `ioscan -m dsf|grep disk|awk '{print $1}`

do

a=`scsimgr get_attr -D $i -a wwid |grep -v -e default -e saved -e SCSI -e name |grep current |awk '{print $3}'`

echo "$i ==> $a"

done > rdisk_wwid

 

now the rdisk_wwid file has all the OS disk DEvice files followed by corresponding WWID.

 

Hope this helps.

 

 

Regards,

VA

Lead Engineer, IMS.
iGATE
Torsten.
Acclaimed Contributor

Re: Identify LUN ID with SCSIMGR

Thanks for reply.

 

I currently have no system access, so I cannot try.

 

But I think this is again NOT what I want to have.

 

The goal is somelike

 

/dev/disk/disk25 is LUN 5 (from array xy)

 

/dev/disk/disk273 is LUN 25

 

etc ...


Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Torsten.
Acclaimed Contributor

Re: Identify LUN ID with SCSIMGR


Duncan Edmonstone wrote:
I can't see a reason why this shouldn't work - I'd be tempted to report that as a bug and see where you get

Can somebody advise me how to do this?


Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
chris huys_4
Honored Contributor

Re: Identify LUN ID with SCSIMGR

>Can somebody advise me how to do this?

Log a support case.

irofrank
Advisor

Re: Identify LUN ID with SCSIMGR

Ok, so after playing around with shell scripting, I've come up with this, and it seems to work... for the most part :)

 

First, run an

 

ioscan -m lun

 

it should produce output similar to what's displayed below.

 

.
.
.
.
disk     49  64000/0xfa00/0x13   esdisk  CLAIMED     DEVICE       online  3PARdataVV
             0/0/0/5/0/0/0.0x20120002ac004b08.0x4004000000000000
             0/0/0/5/0/0/0.0x21120002ac004b08.0x4004000000000000
             0/0/0/5/0/0/1.0x20120002ac004b08.0x4004000000000000
             0/0/0/5/0/0/1.0x21120002ac004b08.0x4004000000000000
                      /dev/disk/disk49   /dev/rdisk/disk49
disk     50  64000/0xfa00/0x14   esdisk  CLAIMED     DEVICE       online  3PARdataVV
             0/0/0/5/0/0/0.0x20120002ac004b08.0x4009000000000000
             0/0/0/5/0/0/0.0x21120002ac004b08.0x4009000000000000
             0/0/0/5/0/0/1.0x20120002ac004b08.0x4009000000000000
             0/0/0/5/0/0/1.0x21120002ac004b08.0x4009000000000000
                      /dev/disk/disk50   /dev/rdisk/disk50
.
.
.
.

I'm using 3PAR, with 2 nodes over FC, so I've got a total of 4 paths per LUN. You may have more, same or less.

 

Next pick a path (any path) from any LUN and copy the hardware path, BUT LEAVE OUT the last section that refers to the LUN ID. For instance, in the example below, copy only the section in bold

 

0/0/0/5/0/0/0.0x20120002ac004b08.0x4009000000000000

Next, paste it into this script, as marked in bold

typeset -i N=1
while (( N <= 100 ))
do
DIR="/dev/rdisk/disk${N}"
if [ -c $DIR ]
then
    echo /dev/rdisk/disk${N}
    scsimgr get_attr -H $(ioscan -m lun /dev/rdisk/disk${N} | grep '0/0/0/5/0/0/0.0x20120002ac004b08') -a lunid
    N=$N+1
else
    N=$N+1
fi
done

You may need to modify the "while" statement to suite your environment, depending on how many disks you have on the server. If you have more than 100 disks, change it appropriately.

 


Lastly, run the script. Below is sample output. I have 9 LUNs. The script prints out the device_file followed by the lunid attribute for the associated LUN.

 

# typeset -i N=1
# while (( N <= 100 ))
> do
> DIR="/dev/rdisk/disk${N}"
> if [ -c $DIR ]
> then
>     echo /dev/rdisk/disk${N}
>     scsimgr get_attr -H $(ioscan -m lun /dev/rdisk/disk${N} | grep '0/0/0/5/0/0/0.0x20120002ac004b08') -a lunid
>     N=$N+1
> else
>     N=$N+1
> fi
> done
/dev/rdisk/disk1
scsimgr: ERROR: Need to specify hardware path with -H
/dev/rdisk/disk7

        SCSI ATTRIBUTES FOR LUN PATH : 0/0/0/5/0/0/0.0x20120002ac004b08.0x4001000000000000

name = lunid
current =0x4001000000000000 (LUN # 1, Flat Space Addressing)
default =
saved =

/dev/rdisk/disk12

        SCSI ATTRIBUTES FOR LUN PATH : 0/0/0/5/0/0/0.0x20120002ac004b08.0x4002000000000000

name = lunid
current =0x4002000000000000 (LUN # 2, Flat Space Addressing)
default =
saved =

/dev/rdisk/disk41
scsimgr: ERROR: Need to specify hardware path with -H
/dev/rdisk/disk42
scsimgr: ERROR: Need to specify hardware path with -H
/dev/rdisk/disk43

        SCSI ATTRIBUTES FOR LUN PATH : 0/0/0/5/0/0/0.0x20120002ac004b08.0x4005000000000000

name = lunid
current =0x4005000000000000 (LUN # 5, Flat Space Addressing)
default =
saved =

/dev/rdisk/disk44

        SCSI ATTRIBUTES FOR LUN PATH : 0/0/0/5/0/0/0.0x20120002ac004b08.0x4006000000000000

name = lunid
current =0x4006000000000000 (LUN # 6, Flat Space Addressing)
default =
saved =

/dev/rdisk/disk45

        SCSI ATTRIBUTES FOR LUN PATH : 0/0/0/5/0/0/0.0x20120002ac004b08.0x4007000000000000

name = lunid
current =0x4007000000000000 (LUN # 7, Flat Space Addressing)
default =
saved =

/dev/rdisk/disk46

        SCSI ATTRIBUTES FOR LUN PATH : 0/0/0/5/0/0/0.0x20120002ac004b08.0x4008000000000000

name = lunid
current =0x4008000000000000 (LUN # 8, Flat Space Addressing)
default =
saved =

/dev/rdisk/disk47
scsimgr: ERROR: Need to specify hardware path with -H
/dev/rdisk/disk48

        SCSI ATTRIBUTES FOR LUN PATH : 0/0/0/5/0/0/0.0x20120002ac004b08.0x4003000000000000

name = lunid
current =0x4003000000000000 (LUN # 3, Flat Space Addressing)
default =
saved =

/dev/rdisk/disk49

        SCSI ATTRIBUTES FOR LUN PATH : 0/0/0/5/0/0/0.0x20120002ac004b08.0x4004000000000000

name = lunid
current =0x4004000000000000 (LUN # 4, Flat Space Addressing)
default =
saved =

/dev/rdisk/disk50

        SCSI ATTRIBUTES FOR LUN PATH : 0/0/0/5/0/0/0.0x20120002ac004b08.0x4009000000000000

name = lunid
current =0x4009000000000000 (LUN # 9, Flat Space Addressing)
default =
saved =

 

I hope HP release a tool soon like xpinfo or evainfo for 3PAR, and save us all the trouble :)

Torsten.
Acclaimed Contributor

Re: Identify LUN ID with SCSIMGR

For 3PAR:

https://h20392.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=3PARinfo

http://h20566.www2.hp.com/portal/site/hpsc/template.BINARYPORTLET/public/kb/docDisplay/resource.process/?javax.portlet.begCacheTok=com.vignette.cachetoken&javax.portlet.endCacheTok=com.vignette.cachetoken&javax.portlet.rid_ba847bafb2a2d782fcbb0710b053ce01=docDisplayResURL&javax.portlet.rst_ba847bafb2a2d782fcbb0710b053ce01=wsrp-resourceState%3DdocId%253Demr_na-c03611522-3%257CdocLocale%253Den_US&ja...

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
irofrank
Advisor

Re: Identify LUN ID with SCSIMGR

Thanks Torsten,

 

I guess they've already done it!

Torsten.
Acclaimed Contributor

Re: Identify LUN ID with SCSIMGR

What happens on your system if you run

# scsimgr -p get_attr all_lun -a lunid

(see my initial question)

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
irofrank
Advisor

Re: Identify LUN ID with SCSIMGR

Hi Torsten,

 

I got blank lines, same as you. What I realized is that "lunid"  doesn't appear to be among the attributes listed.
 

If you do:

 

scsimgr get_attr all_lun

 

It returns all attributes for all luns, but lun id is not listed among lun attributes. However, if you do:

 

scsimgr get_attr -H <Hardware Path>

 

Then lun ID is listed amongst the attributes. So I figured, I'd create a script that gets a device file, get's the corresponding hardware path and echos the LUN id attribute from the hardware path.

 

But looks like 3parinfo might provide what's needed. Anyone actually tired it?