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.
echo "- - -" > /sys/class/scsi_host/hostX/scan
[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/scanTIP:- 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.
- First check number of FC controllers in your system
#ls /sys/class/fc_hosthost0 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_lipTip :- 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