How to Scan Newly added Disks in Linux Easily


How to Scan Newly added Disks in Linux

This post will help you with How to Scan Newly added Disks in Linux Easily

If you are interested in learning, Request you to go through the below recommended tutorial.




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.

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


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.

Support Us: Share with your friends and groups.

Stay connected with us on social networking sites, Thank you.
YouTube | Facebook | Twitter | Pinterest | Rss

Post a Comment

4 Comments

  1. […] https://www.2daygeek.com/scan-detect-luns-scsi-disks-on-redhat-centos-oracle-linux/https://www.learnitguide.net/2016/02/scan-newly-added-fc-luns-and-scsi-disks.htmlhttps://www.unixarena.com/2013/06/how-to-scan-new-fc-luns-and-scsi-disks.html/https://linuxopsys.com/topics/scan-detect-new-luns-on-linuxhttps://www.thegeekdiary.com/how-to-scan-newly-assigned-luns-in-multipathd-under-centos-rhel/https://www.ibm.com/docs/ST2HTZ_1.3.0/svc_linux_onlinerescan.html […]

    ReplyDelete
  2. […] https://www.2daygeek.com/scan-detect-luns-scsi-disks-on-redhat-centos-oracle-linux/https://www.thegeekdiary.com/how-to-scan-newly-assigned-luns-in-multipathd-under-centos-rhel/https://www.learnitguide.net/2016/02/scan-newly-added-fc-luns-and-scsi-disks.htmlhttps://www.unixarena.com/2013/06/how-to-scan-new-fc-luns-and-scsi-disks.html/https://linuxopsys.com/topics/scan-detect-new-luns-on-linuxhttps://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/storage_administration_guide/scanning-storage-interconnectshttps://access.redhat.com/solutions/328493https://www.cloudvedas.com/2017/08/solved-how-to-scan-new-luns-in-redhat.htmlhttps://mylinuxhub.com/how-to-scan-new-lun-in-linux-without-reboot/ […]

    ReplyDelete
  3. […] https://www.learnitguide.net/2016/02/scan-newly-added-fc-luns-and-scsi-disks.htmlhttps://www.unixarena.com/2013/06/how-to-scan-new-fc-luns-and-scsi-disks.html/https://www.2daygeek.com/scan-detect-luns-scsi-disks-on-redhat-centos-oracle-linux/https://www.thegeekdiary.com/how-to-scan-newly-assigned-luns-in-multipathd-under-centos-rhel/https://linuxguruunix.blogspot.com/2016/06/how-to-scan-new-fc-luns-and-scsi-disks.htmlhttps://www.cloudvedas.com/2017/08/solved-how-to-scan-new-luns-in-redhat.htmlhttps://ngelinux.com/how-to-scan-scsi-disks-and-storage-fc-luns-in-linux/https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/storage_administration_guide/scanning-storage-interconnects […]

    ReplyDelete