Recent

How to Scan Newly added FC LUNS and SCSI Disks in Linux

How to Scan Newly added FC LUNS and SCSI Disks in Linux

As a Linux admin, we may come in a situation like, to scan new FC luns or to scan new SCSI Disk which are provided by Storage team. Its need to be scan from the Linux OS side without rebooting server.

So How to scan new FC LUNS and SCSI disks in Linux without rebooting the server?
Here is a solution to scan new disk or Luns assigned to the server.

In Linux we can scan the LUNs using the script "rescan-scsi-bus.sh" or triggering some device host files with some values.

Follow the process to rescan the new added FC Luns:

1. Identify the existing disks
fdisk -l 2>/dev/null | egrep '^Disk' | egrep -v 'dm-|type|identifier'
2. Identify the number of HBA adapters
systool -c fc_host -v
or
ls /sys/class/fc_host
host0
Note the number of hosts available in the server.

3. Use the below command to scan the LUNs
echo "1" > /sys/class/fc_host/host0/issue_lip
echo "- - -" > /sys/class/scsi_host/host0/scan
If you have more number of hosts file under the directory /sys/class/fc_host, then use the command for each hosts file by replacing the "host0".

From Redhat Linux 5.4 onwards, redhat introduced “/usr/bin/rescan-scsi-bus.sh” script to scan all the SCSI bus and update the SCSI layer to reflect new devices.

We can also use the "rescan-scsi-bus.sh" script to detect new LUNs without rebooting the server.
This script is available with sg3-utils package. So install the sg3-utils package.
yum install sg3_utils
rescan-scsi-bus.sh
4. Verify the Detected disks from fdisk again
fdisk -l 2>/dev/null | egrep '^Disk' | egrep -v 'dm-|type|identifier'

Follow the process to rescan the new added SCSI Disks:

1. Identify the existing disks
fdisk -l 2>/dev/null | egrep '^Disk' | egrep -v 'dm-|type|identifier'
2. Identify the number of SCSI Controllers detected
ls /sys/class/scsi_host/
host0
Note the number of hosts available in the server.

3. Scan the SCSI Disk for each hosts
echo "- - -" > /sys/class/scsi_host/host0/scan
If you have more number of hosts file under the directory /sys/class/scsi_host, then use the command for each hosts file by replacing the "host0".

4. Verify the Detected disks from fdisk again
fdisk -l 2>/dev/null | egrep '^Disk' | egrep -v 'dm-|type|identifier'
Thanks for reading our post. share with your friends. We appreciate your feedback, Leave your comments if any.

We have more articles to be updated soon. To not miss any updates, Follow us on social networking sites and Subscribe us on our Youtube channel.
How to Scan Newly added FC LUNS and SCSI Disks in Linux thumbnail Reviewed by Blog Admin on 21:52 Rating: 5

No comments:

All Rights Reserved by Learn IT Guide © 2015 - 2025.

Contact Form

Name

Email *

Message *

Powered by Blogger.