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

Udemy

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 ,

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

VMWare AU/Asia Pacific
  • 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
  • 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. You can ask cloud related questions on it after registering.

Leave a Reply

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