Operating System - HP-UX
1753555 Members
4854 Online
108795 Solutions
New Discussion

Re: Identify LUN ID with SCSIMGR

 
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?