RedHat5 rescan the SCSI bus to see newly presented LUNs without reboot

Until yesterday I was sure that it wasn’t possible to see newly created LUNs without a reboot of the box or a reload of the HBA driver. A discussion with somebody that pretends to be an expert in this, brought me to the point to google around somewhere and to do some tests. What I did was creating a new LUN on the storage and presenting it to the box. Then I executed this command echo "1" > /sys/class/fc_host/host#/issue_lip where # stands for the number of the HBA. It looks that this is not the best way to do it, because I saw a lot of these error messages in the console window.

Message from syslogd@ at Thu Jan 12 15:52:45 2012 …
sclotstdb2 kernel: Error:Mpx:Path Bus 1 Tgt 4 Lun 7 to CKM00094900495 is dead.
Message from syslogd@ at Thu Jan 12 15:52:45 2012 …
sclotstdb2 kernel: Error:Mpx:Path Bus 1 Tgt 4 Lun 1 to CKM00094900495 is dead.
Message from syslogd@ at Thu Jan 12 15:52:45 2012 …
sclotstdb2 kernel: Error:Mpx:Path Bus 1 Tgt 4 Lun 0 to CKM00094900495 is dead.
Message from syslogd@ at Thu Jan 12 15:52:45 2012 …
sclotstdb2 kernel: Error:Mpx:Path Bus 1 Tgt 4 Lun 6 to CKM00094900495 is dead.

 

I checked the message file and found that my existing devices were still there and alive 🙂

Jan 12 15:57:54 sclotstdb2 kernel: Info:Mpx:Path Bus 1 Tgt 4 Lun 1 to CKM00094900495 is alive.
Jan 12 15:57:54 sclotstdb2 kernel: Info:Mpx:Path Bus 1 Tgt 4 Lun 0 to CKM00094900495 is alive.
Jan 12 15:57:54 sclotstdb2 kernel: Info:Mpx:Path Bus 1 Tgt 4 Lun 6 to CKM00094900495 is alive.
Jan 12 15:57:54 sclotstdb2 kernel: Info:Mpx:Path Bus 1 Tgt 4 Lun 5 to CKM00094900495 is alive.
Jan 12 15:57:54 sclotstdb2 kernel: Info:Mpx:Path Bus 1 Tgt 4 Lun 8 to CKM00094900495 is alive.
Jan 12 15:57:54 sclotstdb2 kernel: Info:Mpx:Path Bus 1 Tgt 4 Lun 3 to CKM00094900495 is alive.
Jan 12 15:57:54 sclotstdb2 kernel: Info:Mpx:Path Bus 1 Tgt 4 Lun 4 to CKM00094900495 is alive.
Jan 12 15:57:54 sclotstdb2 kernel: Info:Mpx:Path Bus 1 Tgt 4 Lun 2 to CKM00094900495 is alive.
Jan 12 15:57:54 sclotstdb2 kernel: Info:Mpx:Path Bus 1 Tgt 4 Lun 7 to CKM00094900495 is alive.

….. lucky me ….. 🙂

Anyway, the new LUN wasn’t visible to the system. I checked it with

powermt display dev=all 🙁

So what next? RedHat’s documentation told me what to do here.

Here it’s how to do it:

  • Create the LUN and present it to the box.
  • Either run echo "c t l" > /sys/class/scsi_host/hostH/scan where c=controller, t=target, l=LUN or echo "1" > /sys/class/fc_host/host#/issue_lip where #=number of the HBA(Be warned that you’ll see some strange output, but hey… it works)
  • do a ls -l /dev/disk/by-* and you should see a new device. E.g. I saw this:
    lrwxrwxrwx 1 root root 10 Jan 12 15:43 pci-0000:05:00.1-fc-0x50060168446054fc:0x000d000000000000 -> ../../sdcm
  • If this doesn’t work, try a rescan_scsi_bus.sh script which is part of the sg3_utils package
  • Now do a powermt config
  • Et voila! A powermt display dev=all should show your new device.

The sg3_utils provide you with mighty tools to do tasks like the one above. It is also possible to remove LUNs on the fly. Unnecessary to mention that I will not give you any warranty that this works on your system …. and don’t blame me after you spoiled your system.

About Juergen Caris

I am 54yo, MSc(Dist) and BSc in Computer Science, German and working as a Senior Server Engineer for the NHS Lothian. I am responsible for the patient management system, called TrakCare. I am a UNIX/Linux guy, working in this sector for more than 20 years now. I am also interested in robotics, microprocessors, system monitoring, Home automation and programming.
This entry was posted in Hardware, Linux. Bookmark the permalink.

2 Responses to RedHat5 rescan the SCSI bus to see newly presented LUNs without reboot

  1. seo forum says:

    Hey nice blog, Check out my fourm if you got a second 🙂 http://goo.gl/CWtst

  2. Anonymous says:

    Hi there, I found your site via Google while looking for a related topic, your site came up, it looks great. I have bookmarked it in my google bookmarks.

Leave a Reply

Your email address will not be published.