歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux技術

Scan / Detect New Luns In Redhat Linux & Outputs To Remember

You use the below commands to identify existing LUNS and How to add newly mapped LUNS to Linux.

Check the current attached disks

#cat /proc/scsi/scsi | egrep -i 'Host:' | wc -l#fdisk -l 2>/dev/null | egrep '^Disk' | egrep -v 'dm-' | wc -l

Check current multipath setup using multipath or powermt command

# multipath -lmpath2 (36006016015501c0018c07c18e0d8dc11)

[size=68 GB][features="1 queue_if_no_path"][hwhandler="1 emc"]

\_ round-robin 0 [active]

\_ 0:0:0:2 sdc 8:32 [active]

\_ round-robin 0 [enabled]

\_ 1:0:0:2 sdi 8:128 [active]

mpath1 (36006016015501c0084227c0ee0d8dc11)

[size=68 GB][features="1 queue_if_no_path"][hwhandler="1 emc"]

\_ round-robin 0 [active]

\_ 1:0:0:1 sdh 8:112 [active]

\_ round-robin 0 [enabled]

\_ 0:0:0:1 sdb 8:16 [active]

mpath0 (36006016015501c00b6de3705e0d8dc11)

[size=68 GB][features="1 queue_if_no_path"][hwhandler="1 emc"]

\_ round-robin 0 [active]

\_ 0:0:0:0 sda 8:0 [active]

\_ round-robin 0 [enabled]

\_ 1:0:0:0 sdg 8:96 [active]

mpath7 (36006016015501c00c640c362d2c4df11)

[size=68 GB][features="1 queue_if_no_path"][hwhandler="1 emc"]

\_ round-robin 0 [active]

\_ 1:0:0:7 sdp 8:240 [active]

\_ round-robin 0 [enabled]

\_ 0:0:0:7 sdo 8:224 [active]

mpath6 (36006016015501c0016a5cfc0827add11)

[size=70 GB][features="1 queue_if_no_path"][hwhandler="1 emc"]

\_ round-robin 0 [active]

\_ 0:0:0:6 sdm 8:192 [active]

\_ round-robin 0 [enabled]

\_ 1:0:0:6 sdn 8:208 [active]

mpath5 (36006016015501c009826282ce0d8dc11)

[size=68 GB][features="1 queue_if_no_path"][hwhandler="1 emc"]

\_ round-robin 0 [active]

\_ 1:0:0:5 sdl 8:176 [active]

\_ round-robin 0 [enabled]

\_ 0:0:0:5 sdf 8:80 [active]

mpath4 (36006016015501c0096e1a824e0d8dc11)

[size=68 GB][features="1 queue_if_no_path"][hwhandler="1 emc"]

\_ round-robin 0 [active]

\_ 0:0:0:4 sde 8:64 [active]

\_ round-robin 0 [enabled]

\_ 1:0:0:4 sdk 8:160 [active]

mpath3 (36006016015501c0019c07c18e0d8dc11)

[size=68 GB][features="1 queue_if_no_path"][hwhandler="1 emc"]

\_ round-robin 0 [active]

\_ 1:0:0:3 sdj 8:144 [active]

\_ round-robin 0 [enabled]

\_ 0:0:0:3 sdd 8:48 [active]

#

If EMC powerpath installed check disk /multipath status as below

# powermt display dev=all | more

Pseudo name=emcpowerb

CLARiiON ID=APM00080503154 [cl10083]

Logical device ID=6006016023041F003AB6ED708885DD11 [LUN 3]

state=alive; policy=CLAROpt; priority=0; queued-IOs=0

Owner: default=SP A, current=SP A Array failover mode: 1

==============================================================================

---------------- Host --------------- - Stor - -- I/O Path - -- Stats ---

### HW Path I/O Paths Interf. Mode State Q-IOs Errors

==============================================================================

3 qla2xxx sde SP A2 active alive 0 1

3 qla2xxx sdh SP B3 active alive 0 0

6 qla2xxx sdk SP A3 active alive 0 1

6 qla2xxx sdn SP B2 active alive 0 0

Pseudo name=emcpowerc

CLARiiON ID=APM00080503154 [cl10083]

Logical device ID=6006016023041F007AE5EB628885DD11 [LUN 1]

state=alive; policy=CLAROpt; priority=0; queued-IOs=0

Owner: default=SP A, current=SP A Array failover mode: 1

==============================================================================

---------------- Host --------------- - Stor - -- I/O Path - -- Stats ---

### HW Path I/O Paths Interf. Mode State Q-IOs Errors

==============================================================================

3 qla2xxx sdc SP A2 active alive 0 1

3 qla2xxx sdf SP B3 active alive 0 0

6 qla2xxx sdi SP A3 active alive 0 1

6 qla2xxx sdl SP B2 active alive 0 0

Pseudo name=emcpowera

CLARiiON ID=APM00080503154 [cl10083]

Logical device ID=6006016023041F00AAE0FF698885DD11 [LUN 2]

state=alive; policy=CLAROpt; priority=0; queued-IOs=0

Owner: default=SP B, current=SP B Array failover mode: 1

==============================================================================

---------------- Host --------------- - Stor - -- I/O Path - -- Stats ---

### HW Path I/O Paths Interf. Mode State Q-IOs Errors

==============================================================================

3 qla2xxx sdd SP A2 active alive 0 1

3 qla2xxx sdg SP B3 active alive 0 0

6 qla2xxx sdj SP A3 active alive 0 1

6 qla2xxx sdm SP B2 active alive 0 0

Scan for LUNS

Note this is for 2.6 kernel# ls /sys/class/fc_host

host0 host1

#echo "1" > /sys/class/fc_host/host0/issue_lip

#echo "- - -" > /sys/class/scsi_host/host0/scan

#echo "1" > /sys/class/fc_host/host1/issue_lip

#echo "- - -" > /sys/class/scsi_host/host1/scan

Multpath Daemon and Powerpath (EMC)

Multipath will automatically add new native devices to multipathedFor powermt we need to configure like below

#powermt config

Other options to scan

If we know the channel , target ID , Lun address we can scan using that. Here we have 4 HBA emulex cards 0 1 2 3server1:/proc/scsi/lpfc# ls

0 1 2 3

Through card 0 and 2

server1:/proc/scsi/lpfc# cat 0

lpfc0t00 DID d200ef WWPN 50:06:01:68:39:a0:43:65 WWNN 50:06:01:60:b9:a0:43:65

lpfc0t01 DID d201ef WWPN 50:06:01:61:39:a0:43:65 WWNN 50:06:01:60:b9:a0:43:65

server1:#/proc/scsi/lpfc# cat 1

server1:/proc/scsi/lpfc# cat 2

lpfc2t01 DID ed0cef WWPN 50:06:01:69:39:a0:43:65 WWNN 50:06:01:60:b9:a0:43:65

lpfc2t00 DID ed0def WWPN 50:06:01:60:39:a0:43:65 WWNN 50:06:01:60:b9:a0:43:65

server1:/proc/scsi/lpfc# cat 3

server1:/proc/scsi/lpfc#

It have same WWNN(World Wide Node Name) for all the 4 WWPN (World Wide Port Name)

server1:/proc/scsi/lpfc# cat /sys/class/fc_transport/*/node_name

0x50060160b9a04365

0x50060160b9a04365

0x50060160b9a04365

0x50060160b9a04365

server1:/proc/scsi/lpfc# grep 50060160b9a04365 /sys/class/fc_transport/*/node_name

/sys/class/fc_transport/target0:0:0/node_name:0x50060160b9a04365

/sys/class/fc_transport/target0:0:1/node_name:0x50060160b9a04365

/sys/class/fc_transport/target2:0:0/node_name:0x50060160b9a04365

/sys/class/fc_transport/target2:0:1/node_name:0x50060160b9a04365

server1:/proc/scsi/lpfc#

This indicates there are four Fibre Channel routes to this target.

Line 1 : Thru host 0 channel 0 target 0

Line 2 : Thru host 0 channel 0 target 1

Line 3 : Thru host 2 channel 0 target 0

Line 4 : thru host 2 channel 0 targer 1

So now can scan for LUNS as follows and Addresss "8" is given by storage Team

echo "0 0 8" > /sys/class/scsi_host/host0/scan

echo "0 1 8" > /sys/class/scsi_host/host0/scan

echo "0 0 8" > /sys/class/scsi_host/host2/scan

echo "0 1 8" > /sys/class/scsi_host/host2/scan

Output of SCSI file for reference

Host: scsi0 Channel: 00 Id: 00 Lun: 08

Vendor: DGC Model: RAID 5 Rev: 0326

Type: Direct-Access ANSI SCSI revision: 04

Host: scsi0 Channel: 00 Id: 01 Lun: 08

Vendor: DGC Model: RAID 5 Rev: 0326

Type: Direct-Access ANSI SCSI revision: 04

Host: scsi2 Channel: 00 Id: 00 Lun: 08

Vendor: DGC Model: RAID 5 Rev: 0326

Type: Direct-Access ANSI SCSI revision: 04

Host: scsi2 Channel: 00 Id: 01 Lun: 08

Vendor: DGC Model: RAID 5 Rev: 0326

Type: Direct-Access ANSI SCSI revision: 04

Copyright © Linux教程網 All Rights Reserved