All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: device-mapper development <dm-devel@redhat.com>
Subject: Re: Linux utility to determine WWN from a LUN number
Date: Fri, 14 Mar 2008 08:12:59 +0100	[thread overview]
Message-ID: <47DA257B.70904@suse.de> (raw)
In-Reply-To: <B6FF36386FC9AC4BB098A4528811409F02230CC4@CORPUSMX40A.corp.emc.com>

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 :-)

Cheers,

Hannes
-- 
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)

  reply	other threads:[~2008-03-14  7:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-13 19:32 Linux utility to determine WWN from a LUN number lemons_terry
2008-03-13 20:39 ` Chip Coldwell
2008-03-13 21:43 ` malahal
2008-03-14  2:50   ` lemons_terry
2008-03-14  7:12     ` Hannes Reinecke [this message]
2008-03-14 14:24       ` Chip Coldwell
2008-03-14 21:10       ` lemons_terry
2008-03-14 13:57     ` Chip Coldwell
2008-03-14 14:03       ` Hannes Reinecke
2008-03-14 14:32         ` Chip Coldwell
2008-03-14 14:54           ` Hannes Reinecke
2008-03-14 15:34             ` Chip Coldwell
2008-03-14 15:37               ` Hannes Reinecke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47DA257B.70904@suse.de \
    --to=hare@suse.de \
    --cc=dm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.