• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

UnixArena

  • Home
  • kubernetes
  • DevOps
    • Terraform
    • Jenkins
    • Docker
    • Openshift
      • OKD
    • Ansible engine
    • Ansible Tower
      • AWX
    • Puppet
  • Cloud
    • Azure
    • AWS
    • Openstack
    • Docker
  • VMware
    • vCloud Director
    • VMware-Guests
    • Vcenter Appliance 5.5
    • vC OPS
    • VMware SDDC
    • VMware vSphere 5.x
      • vSphere Network
      • vSphere DS
      • vShield Suite
    • VMware vSphere 6.0
    • VSAN
    • VMware Free Tools
  • Backup
    • Vembu BDR
    • Veeam
    • Nakivo
    • Azure Backup
    • Altaro VMBackup
    • Spinbackup
  • Tutorials
    • Openstack Tutorial
    • Openstack Beginner’s Guide
    • VXVM-Training
    • ZFS-Tutorials
    • NetApp cDot
    • LVM
    • Cisco UCS
    • LDOM
    • Oracle VM for x86
  • Linux
    • How to Articles
    • Q&A
    • Networking
    • RHEL7
  • DevOps Instructor-led Training
  • Contact

How to scan new FC LUNS and SCSI disks in Linux ?

June 20, 2013 By Cloud_Devops 11 Comments

How to scan new FC LUNS and  SCSI disks in Redhat Linux without rebooting the server?  Most of the Linux beginners have to wonder how to do this and this article will be for them. It may look very simple as we perform this in daily operation to scan LUNS but the system has much work to do in the background when you execute storage scanning commands. Redhat says this type of scan can be distributive since it can cause delays while I/O operation timeout and remove devices unexpectedly from OS.

 

Scanning FC-LUN’s in Redhat Linux

1.First, find out how many disks are visible in “fdisk -l” .

# fdisk -l 2>/dev/null | egrep '^Disk' | egrep -v 'dm-' | wc -l

2.Find out how many host bus adapter configured in the Linux box.you can use “systool -fc_host -v” to verify available FC in the system.

# ls /sys/class/fc_host
host0  host1

In this case,you need to scan host0 & host1 HBA.

3.If the system virtual memory is too low ,then do not proceed further.If you have enough free virtual memory,then you can proceed with below command to scan new LUNS.

# 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

Note: You need to monitor the “issue_lip” in /var/log/messages to determine when the scan will complete.This operation is an asynchronous operation.

 

You can also use rescan-scsi-bus.sh script to detect new LUNS.

# yum install sg3_utils
# ./rescan-scsi-bus.sh


4. Verify if the new LUN is visible or not by counting the available disks.

# fdisk -l 2>/dev/null | egrep '^Disk' | egrep -v 'dm-' | wc -l

If any new LUNS added , then you can see more count is more then before scanning the LUNS.

Scanning SCSI DISKS in Redhat Linux

1. Finding the existing disk from fdisk.

[root@mylinz1 ~]# fdisk -l |egrep '^Disk' |egrep -v 'dm-'
Disk /dev/sda: 21.5 GB, 21474836480 bytes

2. Find out how many SCSI controller configured.

[root@mylinz1 ~]# ls /sys/class/scsi_host/host
host0 host1 host2

In this case, you need to scan host0,host1 & host2.


3. Scan the SCSI disks using below command.

[root@mylinz1 ~]# echo "- - -" > /sys/class/scsi_host/host0/scan
[root@mylinz1 ~]# echo "- - -" > /sys/class/scsi_host/host1/scan
[root@mylinz1 ~]# echo "- - -" > /sys/class/scsi_host/host2/scan

4. Verify if the new disks are visible or not.

[root@mylinz1 ~]# fdisk -l |egrep '^Disk' |egrep -v 'dm-'
Disk /dev/sda: 21.5 GB, 21474836480 bytes
Disk /dev/sdb: 1073 MB, 1073741824 bytes
Disk /dev/sdc: 1073 MB, 1073741824 bytes

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

 

But most of the time, the script will not be able to scan new disks and you need to go with echo command.

 

Pro Tip: Load/access your all-time favorite Windows applications remotely from anywhere using your Linux system with virtual PCs by CloudDesktopOnline. For other more such innovative cloud products visit www.Apps4Rent.com.

Do not forget to check out Redhat Enterprise Linux 7 Tutorial .

Here is the step by step guide to scan FC LUNS on Solaris.

Thank you for reading this article.

Filed Under: Linux - How to ? Tagged With: Redhat Linux

Reader Interactions

Comments

  1. saikumar says

    January 31, 2017 at 7:14 pm

    would any please explain what exact mean that “- – – ” in echo “- – – ” > /sys/class/fc_host/hotsx/scan …

    Reply
    • krish says

      March 10, 2017 at 11:56 am

      CTL controller target lun

      Reply
  2. Jagadeesan says

    January 28, 2017 at 10:13 am

    Hi,

    I have doubts regarding LUN configuration on unix, if the LUN having data , how to mount file system without lost data ?

    Can any one guide me solutions.

    Thanks
    Jagadeesan

    Reply
  3. Ajay says

    December 30, 2016 at 2:32 am

    grt… many many thnks

    Reply
  4. Naresh says

    July 1, 2016 at 12:24 pm

    what has to at “- – -” of command
    echo “- – -” > /sys/class/scsi_host/host0/scan
    or it is the same command we have to execute as it is with host name replacement?
    please let me know, I am new to Linux.

    Reply
    • Ramakrishna Talluri says

      September 13, 2016 at 4:14 pm

      Hi Naresh,
      host# is the available HBA representation you can find the HBA in below location.

      ls /sys/class/fc_host

      if the server has 3 HBA then they will be host0 host1 host2

      then you can scan them using below command as mentioned above

      [root@mylinz1 ~]# echo “- – -” > /sys/class/scsi_host/host0/scan
      [root@mylinz1 ~]# echo “- – -” > /sys/class/scsi_host/host1/scan
      [root@mylinz1 ~]# echo “- – -” > /sys/class/scsi_host/host2/scan

      Reply
  5. Laxma Reddy says

    June 10, 2016 at 3:45 pm

    Hi ,

    Very good explanation , thank you very much….

    Keep it up..

    Thanks.

    Reply
  6. Naveen says

    April 12, 2016 at 5:55 pm

    Good article . Thank you

    Reply
  7. mohit says

    January 20, 2016 at 12:30 pm

    good one !~~!……!……..!

    Reply
  8. Zlatan says

    December 16, 2015 at 3:50 am

    Thanks ! this helped me a lot!

    Reply
  9. Adeel Mehmood says

    November 18, 2014 at 12:47 pm

    Great Article and Keep it up .thx

    Reply

Leave a Reply Cancel reply

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

Primary Sidebar

Follow UnixArena

  • Facebook
  • LinkedIn
  • Twitter

Copyright © 2025 · UnixArena ·

Go to mobile version