{"id":2160,"date":"2017-12-23T16:09:55","date_gmt":"2017-12-24T00:09:55","guid":{"rendered":"http:\/\/rglinuxtech.com\/?p=2160"},"modified":"2017-12-23T16:09:55","modified_gmt":"2017-12-24T00:09:55","slug":"scsi-adding-and-removing-disk-without-reboot","status":"publish","type":"post","link":"https:\/\/rglinuxtech.com\/?p=2160","title":{"rendered":"SCSI &#8211; Adding and Removing Disk, Without Reboot.."},"content":{"rendered":"<p>Many aeons ago, I used to have SCSI disks on my ancient Linux systems, but the only SCSI device I attached nowadays was the LTO Tape drive, for full system backups, very occasionally..\u00a0\u00a0 Now, I have the HP RX2600 IA64 system, with nothing but U320 SCSI LVD disks, and needed to find a way of attaching one to my x86_64 system temporarily, to backup\/(re)install the root filesystem, during testing..<\/p>\n<p>The physical attachment is via an LVD\/68-pin adapter, connected to the main SCSI cable, with an external 12v power supply.\u00a0\u00a0 I remembered to connect the disk <span style=\"text-decoration: underline;\">directly<\/span>, after disconnecting the LTO drive..<\/p>\n<div id=\"attachment_2161\" style=\"width: 870px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/rglinuxtech.com\/wp_rglinuxtech\/wp-content\/uploads\/2017\/12\/scsi_disk_attach.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2161\" class=\"size-full wp-image-2161\" src=\"https:\/\/rglinuxtech.com\/wp_rglinuxtech\/wp-content\/uploads\/2017\/12\/scsi_disk_attach.jpg\" alt=\"\" width=\"860\" height=\"357\" srcset=\"https:\/\/rglinuxtech.com\/wp_rglinuxtech\/wp-content\/uploads\/2017\/12\/scsi_disk_attach.jpg 860w, https:\/\/rglinuxtech.com\/wp_rglinuxtech\/wp-content\/uploads\/2017\/12\/scsi_disk_attach-300x125.jpg 300w, https:\/\/rglinuxtech.com\/wp_rglinuxtech\/wp-content\/uploads\/2017\/12\/scsi_disk_attach-768x319.jpg 768w, https:\/\/rglinuxtech.com\/wp_rglinuxtech\/wp-content\/uploads\/2017\/12\/scsi_disk_attach-500x208.jpg 500w\" sizes=\"auto, (max-width: 860px) 100vw, 860px\" \/><\/a><p id=\"caption-attachment-2161\" class=\"wp-caption-text\">SCSI disk attachment<\/p><\/div>\n<p>I used to use the old &#8216;rescan-scsi-bus.sh&#8217; script, but that no longer worked, and I found a useful article on an alternative method, here:\u00a0 <a href=\"https:\/\/geekpeek.net\/rescan-scsi-bus-on-linux-system\/\" target=\"_blank\" rel=\"noopener\">https:\/\/geekpeek.net\/rescan-scsi-bus-on-linux-system\/<\/a>\u00a0\u00a0\u00a0 This suggested running the command on <span style=\"text-decoration: underline;\">every<\/span> scsi hostID, but that seemed a bit of a waste, so I worked out a simpler solution..<\/p>\n<p>First, find the PCI bus ID of the SCSI adapter card (Adaptec, in my case) using <strong><span style=\"font-family: courier new,courier;\"># lspci<\/span><\/strong>:<br \/>\n<strong>.<span style=\"font-family: courier new,courier;\">&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;<\/span><\/strong><br \/>\n<strong><span style=\"font-family: courier new,courier;\">03:04.0 SCSI storage controller: Adaptec ASC-29320ALP U320 (rev 10)<\/span><\/strong><br \/>\n<strong><span style=\"font-family: courier new,courier;\">&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;<\/span><\/strong><\/p>\n<p>Then, look for the <span style=\"text-decoration: underline;\">same<\/span> PCI bus id (<strong>03:04:0<\/strong>, in this case) after entering\u00a0 <strong><span style=\"font-family: courier new,courier;\"># ls \/sys\/class\/scsi_host -l<\/span><\/strong>:<br \/>\n<strong><span style=\"font-family: courier new,courier;\">&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;..<\/span><\/strong><br \/>\n<strong><span style=\"font-family: courier new,courier;\">lrwxrwxrwx 1 root root 0 Dec 23 14:33 host14 -&gt; ..\/..\/devices\/pci0000:00\/0000:00:06.0\/0000:02:00.0\/0000:<span style=\"text-decoration: underline;\">03:04.0<\/span>\/host14\/scsi_host\/host14<\/span><\/strong><br \/>\n<strong><span style=\"font-family: courier new,courier;\">&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;.<\/span><\/strong><\/p>\n<p>This gives you the hostID for the SCSI adapter (<strong>host14<\/strong>, in this example)<\/p>\n<p>Then &#8211; as per the article &#8211; just enter <strong><span style=\"font-family: courier new,courier;\"># echo &#8220;- &#8211; -&#8221; &gt; \/sys\/class\/scsi_host\/host14\/scan<\/span><\/strong><\/p>\n<p>&#8212; and this will find and attach the disk..<\/p>\n<pre><strong># lsscsi<\/strong>\r\n<strong>[0:0:0:0] disk ATA WDC WD20EZRZ-00Z 0A80 \/dev\/sda <\/strong>\r\n<strong>[1:0:0:0] disk ATA WDC WD1001FALS-0 0K05 \/dev\/sdb <\/strong>\r\n<strong>[2:0:0:0] disk ATA WDC WD1001FALS-0 0K05 \/dev\/sdc <\/strong>\r\n<strong>[3:0:0:0] disk ATA WDC WD1001FALS-0 0K05 \/dev\/sdd <\/strong>\r\n<strong>[4:0:0:0] disk ATA WDC WD1001FALS-0 0K05 \/dev\/sde <\/strong>\r\n<strong>[5:0:0:0] disk ATA WDC WD1001FALS-0 0K05 \/dev\/sdf <\/strong>\r\n<strong>[6:0:0:0] disk ATA WDC WD20EARX-00P AB51 \/dev\/sdg <\/strong>\r\n<strong>[7:0:0:0] disk ATA WDC WD20EARX-00P AB51 \/dev\/sdh <\/strong>\r\n<strong>[13:0:0:0] process Marvell 91xx Config 1.01 - <\/strong>\r\n<strong>[14:0:9:0] disk COMPAQ BF07288285 HPB2 \/dev\/sdi<\/strong><\/pre>\n<p>To <span style=\"text-decoration: underline;\">detach<\/span> the disk, enter <strong><span style=\"font-family: courier new,courier;\"># echo 1 &gt; \/sys\/block\/sdi\/device\/delete <\/span><\/strong><span style=\"font-family: courier new,courier;\"><span style=\"font-family: arial,helvetica,sans-serif;\">&#8211; where <span style=\"font-family: courier new,courier;\"><strong>sdi<\/strong><\/span> is the SCSI disk ID from the <strong><span style=\"font-family: courier new,courier;\">lsscsi<\/span><\/strong> example above ..<\/span><\/span><strong><span style=\"font-family: courier new,courier;\"><br \/>\n<\/span><\/strong><\/p>\n<p>Tested, and works successfully, on Kernel 4.14.8, Fedora 27.<\/p>\n<p><em>Robert Gadsdon\u00a0 December 22, 2017.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Many aeons ago, I used to have SCSI disks on my ancient Linux systems, but the only SCSI device I attached nowadays was the LTO Tape drive, for full system backups, very occasionally..\u00a0\u00a0 Now, I have the HP RX2600 IA64 system, with nothing but U320 SCSI LVD disks, and needed to find a way of attaching one <span class=\"excerpt-dots\">&hellip;<\/span> <a class=\"more-link\" href=\"https:\/\/rglinuxtech.com\/?p=2160\"><span class=\"more-msg\">Continue reading &rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[1298,15,19,22],"tags":[1776,1778,154,242,1775,1777,331],"class_list":["post-2160","post","type-post","status-publish","format-standard","hentry","category-hardware","category-linux-2","category-opinion","category-scsi-2","tag-attach","tag-detach","tag-fedora-2","tag-linux","tag-lvd-disk","tag-no-reboot","tag-scsi"],"_links":{"self":[{"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/posts\/2160","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2160"}],"version-history":[{"count":3,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/posts\/2160\/revisions"}],"predecessor-version":[{"id":2164,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/posts\/2160\/revisions\/2164"}],"wp:attachment":[{"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2160"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2160"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2160"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}