{"id":3070,"date":"2014-05-28T18:38:28","date_gmt":"2014-05-28T10:38:28","guid":{"rendered":"http:\/\/rmohan.com\/?p=3070"},"modified":"2014-05-28T18:39:29","modified_gmt":"2014-05-28T10:39:29","slug":"how-to-rescan-the-new-storage-lun-in-linux","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=3070","title":{"rendered":"How to rescan the new Storage (LUN) in Linux without reboot"},"content":{"rendered":"<div class=\"article-header\" style=\"color: #000000;\"><\/div>\n<div class=\"article-content entry-content\">\n<div dir=\"ltr\">In order to get the fiber channel adapters detail to rescan, list the \/sys\/class\/fc_host<br \/>\ndirectory. In old RHEL \u00a0host you will not be getting this listing. In this case you can use<br \/>\nthe \/sys\/class\/scsi_host directory but it will list all internal adapters too.1. In Order to scan New Lun we need to run LIP (Loop Initialization Protocol) on the<br \/>\ninterconnect to update the scsi layer to reflect the devices currently on the bus. LIP, is a<br \/>\nbus reset which cause the device addition and removal.<\/p>\n<p># ls -l \/sys\/class\/fc_host<br \/>\ntotal 0<br \/>\ndrwxr-xr-x 3 root root 0 Feb 27 09:11 host0<br \/>\ndrwxr-xr-x 3 root root 0 Feb 27 09:11 host1<\/p>\n<p>2. Make the OS aware of the new storage<br \/>\n#echo &#8220;1&#8221; &gt; \/sys\/class\/fc_host\/host1\/issue_lip<br \/>\n#echo &#8220;1&#8221; &gt; \/sys\/class\/fc_host\/host2\/issue_lip<br \/>\n#echo &#8220;- &#8211; -&#8221; &gt; \/sys\/class\/scsi_host\/host1\/scan<br \/>\n#echo &#8220;- &#8211; -&#8221; &gt; \/sys\/class\/scsi_host\/host2\/scan<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h3>Linux detecting SAN LUN without reboot<\/h3>\n<p>Detecting\u00a0SAN LUN without rebooting the server in Linux<\/p>\n<p><strong>Rescan the bus by echoing the \/sys filesystem (only for Linux 2.6 kernels)<\/strong><\/p>\n<p>For Linux 2.6 kernels only, a\u00a0rescan\u00a0can be triggered through the \/sys interface without having to unload the host adapter driver or reboot the system. The following command will scan all channels, targets, and LUNs on host H.<\/p>\n<p>echo &#8220;- &#8211; -&#8221; &gt; \/sys\/class\/scsi_host\/host_H\/scan<\/p>\n<p>Example:<\/p>\n<p>echo &#8220;- &#8211; -&#8221; &gt; \/sys\/class\/scsi_host\/host1\/scan<\/p>\n<p>echo &#8220;- &#8211; -&#8221; &gt; \/sys\/class\/scsi_host\/hos2\/scan<br \/>\necho &#8220;- &#8211; -&#8221; &gt; \/sys\/class\/scsi_host\/hos4\/scan<br \/>\necho &#8220;- &#8211; -&#8221; &gt; \/sys\/class\/scsi_host\/hos4\/scan<\/p>\n<p>OR<br \/>\nfor host in `ls \/sys\/class\/scsi_host\/`;do<br \/>\necho &#8220;- &#8211; -&#8221; &gt;\/sys\/class\/scsi_host\/${host}\/scan<br \/>\ndone<\/p>\n<p>Note: Below is the explanation about wild card ..<\/p>\n<p>&#8220;- &#8211; -&#8221; in the above means C T L[&#8220;Channel on HBA&#8221; &#8220;Target SCSI id&#8221; &#8220;Lun&#8221;]<br \/>\n&#8220;- &#8211; -&#8221; is a wild card instead of specifying the C T L.<\/p>\n<p>3. After rescanning, confirm whether you are seeing the new storage disks LUN] by listing the<br \/>\ncontent under proc<br \/>\n# cat \/proc\/scsi\/scsi | grep scsi | uniq<\/p>\n<p>4. Now we can list the newly scanned LUN using ????fdisk -l???? command.<br \/>\n# fdisk -l<\/p>\n<p>5. If we have multipath configured then we can see as below:<br \/>\n# multipath<br \/>\n# multipath -ll<\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p> In order to get the fiber channel adapters detail to rescan, list the \/sys\/class\/fc_host directory. In old RHEL host you will not be getting this listing. In this case you can use the \/sys\/class\/scsi_host directory but it will list all internal adapters too.1. In Order to scan New Lun we need to run LIP [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3070"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3070"}],"version-history":[{"count":2,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3070\/revisions"}],"predecessor-version":[{"id":3072,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3070\/revisions\/3072"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3070"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3070"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3070"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}