LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   How to find WWN for /dev/sdc (https://www.linuxquestions.org/questions/linux-server-73/how-to-find-wwn-for-dev-sdc-917269/)

usao 12-05-2011 12:57 PM

How to find WWN for /dev/sdc
 
I have several Clariion luns presented to CentOS 6. They show-up as /dev/sdb, /dev/sdc, etc...
I need to associate which LUN WWN from the Clariion maps to which sdX device.
Im in the process of swapping out some of these luns but can't tell which LUN is associated to which /dev/sdX.

prayag_pjs 12-05-2011 01:20 PM

In Linux sg_map and systool may help you!

To find Fiber Channel addresses of the HBAs
Code:

systool -c fc_host -v
To determine the fibre channel target WWN
Code:

systool -c fc_transport -v
To determine the mapping between SCSI HBTL addresses & disks
Code:

sg_map -x
You can find info under filesystem

Code:

/proc/scsi/hbaxxx/*

usao 12-05-2011 01:51 PM

I found and installed the sysfsutils package, then tried the commands which didn't seem to return much usefull information.
What im really after is a way to tell what the underlying WWN for a given /dev/sdX is.
# systool -c fc_host -v
Class = "fc_host"

# systool -c fc_transport -v
Class = "fc_transport"

# sg_map -x
/dev/sg0 1 0 0 0 5 /dev/scd0
/dev/sg1 2 0 0 0 0 /dev/sda
/dev/sg2 2 0 1 0 0 /dev/sdb
/dev/sg3 2 0 2 0 0 /dev/sdc
/dev/sg4 2 0 3 0 0 /dev/sdd
/dev/sg5 3 0 1 0 0 /dev/sde

pantdk 12-05-2011 01:51 PM

you try this also

Quote:

systool -c scsi_host -v

usao 12-05-2011 01:54 PM

The WWN's that I have presented to the host are:
600508b40008d16e0001400001020000
600508b40008d16e0001400001190000
600508b40008d16e0001400001200000
600508b40008d16e00014000012a0000
The devices the host sees are:
/dev/sdb
/dev/sdc
/dev/sdd
/dev/sde
Trouble is that I can't tell which LUN is associated to which device. I need to remove and replace some of the luns but I can't tell which devices they map to in the host OS environment.

usao 12-05-2011 01:56 PM

That gives a lot of info, but I don't see anything which looks like a WWN in the output...
# systool -c scsi_host -v
Class = "scsi_host"

Class Device = "host0"
Class Device path = "/sys/devices/pci0000:00/0000:00:07.1/host0/scsi_host/host0"
active_mode = "Initiator"
can_queue = "1"
cmd_per_lun = "1"
host_busy = "0"
proc_name = "ata_piix"
prot_capabilities = "0"
prot_guard_type = "0"
scan = <store method only>
sg_tablesize = "128"
state = "running"
supported_mode = "Initiator"
uevent =
unchecked_isa_dma = "0"
unique_id = "1"

Device = "host0"
Device path = "/sys/devices/pci0000:00/0000:00:07.1/host0"
uevent = "DEVTYPE=scsi_host"


Class Device = "host1"
Class Device path = "/sys/devices/pci0000:00/0000:00:07.1/host1/scsi_host/host1"
active_mode = "Initiator"
can_queue = "1"
cmd_per_lun = "1"
host_busy = "0"
proc_name = "ata_piix"
prot_capabilities = "0"
prot_guard_type = "0"
scan = <store method only>
sg_tablesize = "128"
state = "running"
supported_mode = "Initiator"
uevent =
unchecked_isa_dma = "0"
unique_id = "2"

Device = "host1"
Device path = "/sys/devices/pci0000:00/0000:00:07.1/host1"
uevent = "DEVTYPE=scsi_host"


Class Device = "host2"
Class Device path = "/sys/devices/pci0000:00/0000:00:10.0/host2/scsi_host/host2"
active_mode = "Initiator"
board_assembly = "0"
board_name = "0"
board_tracer = "0"
can_queue = "127"
cmd_per_lun = "7"
debug_level = "00000000h"
device_delay = "00"
host_busy = "0"
io_delay = "00"
proc_name = "mptspi"
prot_capabilities = "0"
prot_guard_type = "0"
scan = <store method only>
sg_tablesize = "128"
state = "running"
supported_mode = "Initiator"
uevent =
unchecked_isa_dma = "0"
unique_id = "0"
version_bios = "05.02.00.00"
version_fw = "01.03.41.32"
version_mpi = "102"
version_nvdata_default= "00h"
version_nvdata_persistent= "00h"
version_product = "LSI53C1030 B0"

Device = "host2"
Device path = "/sys/devices/pci0000:00/0000:00:10.0/host2"
uevent = "DEVTYPE=scsi_host"


Class Device = "host3"
Class Device path = "/sys/devices/pci0000:00/0000:00:11.0/0000:02:00.0/host3/scsi_host/host3"
active_mode = "Initiator"
board_assembly = "0"
board_name = "0"
board_tracer = "0"
can_queue = "127"
cmd_per_lun = "7"
debug_level = "00000000h"
device_delay = "00"
host_busy = "0"
io_delay = "00"
proc_name = "mptspi"
prot_capabilities = "0"
prot_guard_type = "0"
scan = <store method only>
sg_tablesize = "128"
state = "running"
supported_mode = "Initiator"
uevent =
unchecked_isa_dma = "0"
unique_id = "1"
version_bios = "05.02.00.00"
version_fw = "01.03.41.32"
version_mpi = "102"
version_nvdata_default= "00h"
version_nvdata_persistent= "00h"
version_product = "LSI53C1030 B0"

Device = "host3"
Device path = "/sys/devices/pci0000:00/0000:00:11.0/0000:02:00.0/host3"
uevent = "DEVTYPE=scsi_host"

pantdk 12-05-2011 02:06 PM

so what about the suggested
Quote:

systool -c fc_host -v

usao 12-05-2011 02:08 PM

# systool -c fc_host -v
Class = "fc_host"

pantdk 12-05-2011 03:24 PM

So it's my physical machine. & this is the one of my HBA OUTPUT
I don't why happen this with u

# systool -c fc_host -v
Class = "fc_host"

Class Device = "host2"
Class Device path = "/sys/class/fc_host/host2"
active_fc4s = "0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x01 0x00 0x00 0x0 0 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0 0 0x00 0x00 0x00 0x00 0x00 "
fabric_name = "0x20c8000decdde701"
issue_lip = <store method only>
maxframe_size = "2048 bytes"
node_name = "0x20000000c99d8374"
port_id = "0x160610"
port_name = "0x10000000c99d8374"
port_state = "Online"
port_type = "NPort (fabric via point-to-point)"
speed = "4 Gbit"
supported_classes = "Class 3"
supported_fc4s = "0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x01 0x00 0x00

OR follow this link & resolve your problem

http://www.torontoaix.com/linux-how-...tips/wwn-linux

Quote:

# cat scsi_id -s /sys/block/sda/sda1/dev

anomie 12-05-2011 04:29 PM

@usao: You've already got your answer in post #2. (At least for RHEL5! Not sure about CentOS6.) Note that you'll need to install the sg3_utils package.

If you should happen to be using DM-Multipath, it provides this information as well, and makes it trivial to match WWNs with block device names.

-------

Sorry, just read further along in the thread. How long are you waiting for systool(1) to provide information? Perhaps rescan your SCSI bus and/or reboot if you haven't already. (This is usually necessary following certain LUN changes.)

usao 12-05-2011 06:16 PM

I don't know if it makes any difference, but this is a VM running on top of ESXi 5. The luns are presented directly to the VM though using direct device mapping.
I have the sg3_utils installed, when I look at the following output it's showing output, but I don't know how to interpret these numbers:
# head /sys/block/sd*/sd*/dev
==> /sys/block/sda/sda1/dev <==
8:1

==> /sys/block/sda/sda2/dev <==
8:2

==> /sys/block/sdb/sdb1/dev <==
8:17

==> /sys/block/sdc/sdc1/dev <==
8:33

==> /sys/block/sdd/sdd1/dev <==
8:49

==> /sys/block/sde/sde1/dev <==
8:65
# /usr/bin/rescan-scsi-bus.sh
Host adapter 0 (ata_piix) found.
Host adapter 1 (ata_piix) found.
Host adapter 2 (mptspi) found.
Host adapter 3 (mptspi) found.
Scanning SCSI subsystem for new devices
Scanning host 0 for SCSI target IDs 0 1 2 3 4 5 6 7, all LUNs
Scanning host 1 for SCSI target IDs 0 1 2 3 4 5 6 7, all LUNs
Scanning for device 1 0 0 0 ...
OLD: Host: scsi1 Channel: 00 Id: 00 Lun: 00
Vendor: NECVMWar Model: VMware IDE CDR10 Rev: 1.00
Type: CD-ROM ANSI SCSI revision: 05
Scanning host 2 channels 0 for SCSI target IDs 0 1 2 3 4 5 6 7, all LUNs
Scanning for device 2 0 0 0 ...
OLD: Host: scsi2 Channel: 00 Id: 00 Lun: 00
Vendor: VMware Model: Virtual disk Rev: 1.0
Type: Direct-Access ANSI SCSI revision: 02
Scanning for device 2 0 1 0 ...
OLD: Host: scsi2 Channel: 00 Id: 01 Lun: 00
Vendor: HP Model: HSV300 Rev: 1000
Type: Direct-Access ANSI SCSI revision: 05
Scanning for device 2 0 2 0 ...
OLD: Host: scsi2 Channel: 00 Id: 02 Lun: 00
Vendor: HP Model: HSV300 Rev: 1000
Type: Direct-Access ANSI SCSI revision: 05
Scanning for device 2 0 3 0 ...
OLD: Host: scsi2 Channel: 00 Id: 03 Lun: 00
Vendor: HP Model: HSV300 Rev: 1000
Type: Direct-Access ANSI SCSI revision: 05
Scanning host 3 channels 0 for SCSI target IDs 0 1 2 3 4 5 6 7, all LUNs
Scanning for device 3 0 1 0 ...
OLD: Host: scsi3 Channel: 00 Id: 01 Lun: 00
Vendor: HP Model: HSV300 Rev: 1000
Type: Direct-Access ANSI SCSI revision: 05
0 new device(s) found.
0 device(s) removed.

christr 08-11-2014 01:27 PM

Did you ever find an answer to this question? I have the same issue where I have ESX 5 host mapping several direct "Mapped Raw LUNs" that I need to know their WWNs to. I also can't find the WWN for each LUN in vSphere. When I added some LUNs I could see their WWNs in vSphere, but not on the disks after they've been added to the VM. Now it only shows me the SCSI device node ID, but those don't match with what I see in the OS when I run lsscsi or sg_map -x.

pantdk 08-11-2014 11:11 PM

I think that might work for you

http://kb.vmware.com/selfservice/mic...rnalId=1003973

http://www.vmware.com/pdf/esx25_rawdevicemapping.pdf

christr 08-12-2014 09:44 AM

Thanks. One quandary I run into though is how to tell what the WWN is for LUNs that are "Mapped Raw LUNs" from the Linux OS side. On physical machines I can just run "scsi_id -g -s /block/sd*" to find out the WWN for an specific SAN disk. However, when running that same command from inside a VM that doesn't work. Does anyone know how to determine a WWN from inside Red Hat Linux while in a VM?

In some situations I've been able to determine which disk is which by doing an lsscsi, and comparing the virtual device node SCSI ID, but sometimes that doesn't match up with what lsscsi output shows.

pantdk 08-12-2014 08:17 PM

In VM we need only uuid not WWPN or WWN number of any disk if you need any information related to the disk then below are command for the same.

Like in RHEL6 if you need to install ASM then there is no package for that, hence we need configure the udev rule so that RAW disk work perfectly so we generated the UUID of the disk in the VM below are the command used fot that


scsi_id command examples

For SCSI attached disk use scsi_id command which queries a SCSI device via the SCSI INQUIRY vital product data (VPD) page 0x80 or 0x83 and uses the resulting data to generate a value that is unique across all SCSI devices that properly support page 0x80 or page 0x83.
# scsi_id -s /block/sda
# scsi_id -a -s /block/sda
# scsi_id -gus /block/sda

Where,

-s : Generate an id for the sysfs-device
-a : Always print information (model, vendor strings) about the device even if it does not support VPD pages.
-g : Treat the device as white listed. The -g option must be specified on the command line or in the scsi_id configuration file for scsi_id to gener ate any output
-u : Reformat the output : replace all whitespaces by underscores


As you said
Quote:

"However, when running that same command from inside a VM that doesn't work. Does anyone know how to determine a WWN from inside Red Hat Linux while in a VM?"
for that below are Procedure to enable uuid in the vm machine


shut down your virtual machine
right-click the VM’s entry in the left-hand panel and select Edit Settings
click the Options tab Select the Advanced -> General item on the left and click the Configuration Parameters... button you then see displayed on the right
Click the Add Row button
Add disk.EnableUUID as the name of the new row, and the word TRUE as its value (don’t use quotation marks around either of these entries).
Click OK to make the new parameter addition ‘stick’.
You can then reboot your virtual machine.

disk.EnableUUID = TRUE



Quote:

In some situations I've been able to determine which disk is which by doing an lsscsi, and comparing the virtual device node SCSI ID, but sometimes that doesn't match up with what lsscsi output shows.
that will help you to compare the Graphic view of the VM disk in the settings tap & Below command

Quote:

#sudo find /sys/devices -name block:sd* |awk -F/ '{ print $NF, $(NF-1)}' |awk -F: '{ print $2 ":" $4 }'
sdb 0:1
sda 0:0


All times are GMT -5. The time now is 11:11 AM.