Solved: How to scan new LUNs in Redhat Linux

In this post  we will discuss how to scan new LUNs allocated by storage team to a Redhat Linux system.

There are two ways of scanning the LUNs

Method 1:-

Find how many SCSI bus controllers you have

  • Go to directory /sys/class/scsi_host/  and list it’s contents.
cd /sys/class/scsi_host/ 

[root@scsi_host]# ls
host0 host1 host2
[root@scsi_host]#
  • Here we can see we have three SCSI bus controllers. So in below command replace hostX with these directory names.

Run the Command ,

Udemy
echo "- - -" > /sys/class/scsi_host/hostX/scan

e.g. 

[root@cloudvedas]# echo "- - -" > /sys/class/scsi_host/host0/scan
[root@cloudvedas]# echo "- - -" > /sys/class/scsi_host/host1/scan
[root@cloudvedas]# echo "- - -" > /sys/class/scsi_host/host2/scan
[root@cloudvedas]# echo "- - -" > /sys/class/scsi_host/host3/scan

TIP:- Here the “- – -” denotes CxTxDx i.e. Channel(controller) , Target ID and Disk or LUN number. This is asked in Linux Admin Interviews also.

  • Repeat the above step for all three directories.

If you have FC HBA in the system you can follow the steps as below:-

  • First check number of FC controllers in your system
#ls /sys/class/fc_host
host0 host1 host2
  • To scan FC LUNs execute commands as
echo "1" > /sys/class/fc_host/host0/issue_lip
echo "1" > /sys/class/fc_host/host1/issue_lip
echo "1" > /sys/class/fc_host/host2/issue_lip

Tip :- Here echo “1” operation performs a Loop Initialization Protocol (LIP) and then scans the interconnect and causes the SCSI layer to be updated to reflect the devices currently on the bus. A LIP is, essentially, a bus reset,  and will cause device addition and removal. This procedure is necessary to configure a new SCSI target on a Fibre Channel interconnect. Bear in mind that issue_lip is an asynchronous operation.

  • Verify if the new disk is visible now
fdisk -l |egrep '^Disk' |egrep -v 'dm-'

Method 2 :-

  • Next method is to scan using SG3 utility. You can install it using
yum install sg3_utils
  • Once installed  run the command
/usr/bin/rescan-scsi-bus.sh

 

2 Replies to “Solved: How to scan new LUNs in Redhat Linux”

  1. Wonderful website you have here but I was wanting to know if you knew of any message boards that cover the same topics talked about here?
    I’d really like to be a part of online community where I can get comments
    from other experienced people that share the same interest.
    If you have any recommendations, please let me know. Cheers!

    1. Hi,
      Thanks for the suggestion. We are happy to inform you that our forum is now available. It’s link is in the top menu. You can ask cloud or OS related questions on it after registering.

Leave a Reply

Your email address will not be published. Required fields are marked *