[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [dm-devel] Linux utility to determine WWN from a LUN number

lemons_terry emc com wrote:
>> lemons_terry emc com [lemons_terry emc com] wrote:
>>> Hi
>>> I want to have multipath manage only the CLARiiON LUN that I boot
> from (LUN 0).  So I know that I can specify the following in
> /etc/multipath.conf:
>>> blacklist {
>>> 	wwid *
>>> 	}
>>> blacklist_exceptions {
>>> 	wwid nnnnnnnnnn
>>> 	}
>>> The wwid value is different for every CLARiiON LUN.  So, if I want to
> automate the process of adding the 'wwid' value to the blacklist, what
> utility can I use to specify a LUN number, and find the WWN of the LUN?
>>> Thanks!
>>> tl
>> lsscsi, lists all your SCSI devices. It should have LUN number and
>> device name. You can use scsi_id to get WWN. lsscsi uses "sysfs" file
>> system (/sys/class/scsi_device/ etc), so you should be able to write
>> your own to suite your exact needs.
> Sorry, but doesn't scsi_id only return what it finds in SCSI VPD pages
> 80 or 83?  Not all devices provide a WWN in VPD page 83.
The WWN is either in VPD page 0x83 or 0x80 (in that order of preference).
You should be using the utility 'scsi_id' to generate the WWN for a given
path (eg call it like 'scsi_id -g -u -s /block/sdX'), as this is the same
program multipath is using.

So the scsi_id program will give a you a mapping sdX -> WWN. And to get
the mapping 'LUN -> sdX' you can simply do a

( cd -P /sys/block/sdX/device; echo ${PWD##*/} )

which will display the SCSI ID of the device; the last number of which is
the LUN presented to the OS.

The remainder is left as an exercise to the reader :-)


Dr. Hannes Reinecke		      zSeries & Storage
hare suse de			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]