To configure the newly added LUNS on RHEL:
# ls /sys/class/fc_host
host0 host1 host2 host3 fdisk -l 2>/dev/null | egrep '^Disk' | egrep -v 'dm-' | wc -l 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 echo "1" > /sys/class/fc_host/host2/issue_lip echo "- - -" > /sys/class/scsi_host/host2/scan echo "1" > /sys/class/fc_host/host3/issue_lip echo "- - -" > /sys/class/scsi_host/host3/scan cat /proc/scsi/scsi | egrep -i 'Host:' | wc -l fdisk -l 2>/dev/null | egrep '^Disk' | egrep -v 'dm-' | wc -l
Alternatively, we can
run the re-scan-scsi script.
To scan new LUNs on Linux operating system which is using QLogic driver
You need to find out driver proc file /proc/scsi/qlaXXX.
For example on my system it is /proc/scsi/qla2300/0
Once file is identified you need to type following command (login as the root):
# echo "scsi-qlascan" > /proc/scsi/qla2300/0
# cat /proc/scsi/qla2300/0
Now use the script rescan-scsi-bus.sh new LUN as a device. Run script as follows:
# ./rescan-scsi-bus.sh -l -w
The output of ls -l /sys/block/*/device should give you an idea about how each device is connected to the system.
16 comments
Write commentsGood one...
ReplyNice Info. Thanks for sharing.
ReplyThanks for visiting and comment..!
Replygud one dude
Reply@Anony: Thanks for visit and comment
ReplyExcellent.. it works!!
Reply@Sergio
ReplyThanks for your feedback..!
Nice share.. thank you
ReplyThat saved me a reboot for a PROD....Thanks much!!!
Replyhow to identify newly added luns to a box
Replyi used to reboot the server to discover newly added luns. Thanks alot Partibhan for providing such a good and simple procedure to scan luns. Thanks again...
ReplyGood work thanks
ReplyReally very useful. do you have doc for redhat cluster config
ReplyLook at http://www.lazysystemadmin.com/2010/03/redhat-cluster-setup-guide.html
ReplyThe rescan command did not work for me. The LUNs are presented, yet still unable to locate these:
Reply# ./rescan-scsi-bus.sh
WARN: /usr/bin/sg_inq not present -- please install sg3_utils
or rescan-scsi-bus.sh might not fully work.
Host adapter 0 (hpsa) found.
Host adapter 1 (qla2xxx) found.
Host adapter 2 (qla2xxx) found.
Host adapter 3 (be2iscsi) found.
Host adapter 4 (be2iscsi) 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 for device 0 0 0 0 ...
OLD: Host: scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: HP Model: LOGICAL VOLUME Rev: 3.66
Type: Direct-Access ANSI SCSI revision: 05
Scanning for device 0 3 0 0 ...
OLD: Host: scsi0 Channel: 03 Id: 00 Lun: 00
Vendor: HP Model: P410i Rev: 3.66
Type: RAID ANSI SCSI revision: 05
Scanning host 1 for all SCSI target IDs, all LUNs
Scanning for device 1 0 0 254 ...
OLD: Host: scsi1 Channel: 00 Id: 00 Lun: 254
Vendor: 3PARdata Model: SES Rev: 3111
Type: Enclosure ANSI SCSI revision: 05
..... [SNIP]...
Scanning for device 2 0 3 9 ...
OLD: Host: scsi2 Channel: 00 Id: 03 Lun: 09
Vendor: 3PARdata Model: VV Rev: 3111
Type: Direct-Access ANSI SCSI revision: 05
Scanning for device 2 0 3 10 ...
OLD: Host: scsi2 Channel: 00 Id: 03 Lun: 10
Vendor: 3PARdata Model: VV Rev: 3111
Type: Direct-Access ANSI SCSI revision: 05
Scanning for device 2 0 4 0 ...
OLD: Host: scsi2 Channel: 00 Id: 04 Lun: 00
Vendor: HP Model: Ultrium 5-SCSI Rev: Y5AZ
Type: Sequential-Access ANSI SCSI revision: 06
Scanning for device 2 0 5 0 ...
OLD: Host: scsi2 Channel: 00 Id: 05 Lun: 00
Vendor: HP Model: Ultrium 5-SCSI Rev: Y5AZ
Type: Sequential-Access ANSI SCSI revision: 06
Scanning host 3 for SCSI target IDs 0 1 2 3 4 5 6 7, all LUNs
Scanning host 4 for SCSI target IDs 0 1 2 3 4 5 6 7, all LUNs
0 new device(s) found.
0 device(s) removed.
Hi,
ReplyI am new to Scaning/Detecting Luns on Redhat Linux.
I know disk names line /dev/sda,/dev/sdb or /dev/had,/dev/hdb
Can you please let me know how the disk names comes after detecting the lun in Rhel5/6 with below commands?
# ls /sys/class/fc_host
host0 host1 host2 host3
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
echo "1" > /sys/class/fc_host/host2/issue_lip
echo "- - -" > /sys/class/scsi_host/host2/scan
echo "1" > /sys/class/fc_host/host3/issue_lip
echo "- - -" > /sys/class/scsi_host/host3/scan
Please let me Know.
What do you think about this Article? Add your Opinion..! EmoticonEmoticon