While Working on the Linux boxes, sometimes the Linux admin has to scan new storage or LUNs assign to the server from the Storage team. In Redhat Linux and CentOS we can scan the LUNs either using the script ‘rescan-scsi-bus.sh’ or using the ‘/sys/class’ files without rebooting the server.
In my scenario, I have 4 FC (Fiber Channel) ports on the server, and new Luns are assigned on these ports. Follow the below steps to detect or scan new Luns.
Method 1
First Check the Fibre channels using the below Command:
# ls /sys/class/fc_host host0 host1 host2 host3
Now Scan New luns using below Commands:
# 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
Method 2
The sg3_utils package provides the rescan-scsi-bus.sh script, this script scans new luns on redhat linux and CentOS. So to use this script first we have to install sg3_utils rpm.
# yum install sg3_utils # ./rescan-scsi-bus.sh
Now the Check the newly discovered disks using ‘fdisk -l’ command or by ‘multipath -l’ command if configured.
# fdisk -l # multipath -l