<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://aznot.com/index.php?action=history&amp;feed=atom&amp;title=Linux%2FSCSI</id>
	<title>Linux/SCSI - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://aznot.com/index.php?action=history&amp;feed=atom&amp;title=Linux%2FSCSI"/>
	<link rel="alternate" type="text/html" href="https://aznot.com/index.php?title=Linux/SCSI&amp;action=history"/>
	<updated>2026-04-30T05:50:33Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://aznot.com/index.php?title=Linux/SCSI&amp;diff=250&amp;oldid=prev</id>
		<title>Kenneth: Created page with &quot;== Linux - Rescan SCSI bus without reboot ==  [http://www.linuxjournal.com/article/7321 Kernel Korner - Storage Improvements for 2.6 and 2.7]  Because most RAID arrays allow L...&quot;</title>
		<link rel="alternate" type="text/html" href="https://aznot.com/index.php?title=Linux/SCSI&amp;diff=250&amp;oldid=prev"/>
		<updated>2014-06-25T18:50:23Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;== Linux - Rescan SCSI bus without reboot ==  [http://www.linuxjournal.com/article/7321 Kernel Korner - Storage Improvements for 2.6 and 2.7]  Because most RAID arrays allow L...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Linux - Rescan SCSI bus without reboot ==&lt;br /&gt;
&lt;br /&gt;
[http://www.linuxjournal.com/article/7321 Kernel Korner - Storage Improvements for 2.6 and 2.7]&lt;br /&gt;
&lt;br /&gt;
Because most RAID arrays allow LUNs to be created, removed and resized dynamically, it is important that the Linux kernel to react to these actions, preferably without a reboot. The Linux 2.6 kernel permits this by way of the /sys filesystem, which replaced the earlier /proc interfaces. For example, the following command causes the kernel to forget about the LUN on busid 3, channel 0, target 7 and LUN 1:&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;1&amp;quot; &amp;gt; \&lt;br /&gt;
 /sys/class/scsi_host/host3/device/3:0:7:1/delete&lt;br /&gt;
&lt;br /&gt;
To scan all channels, targets and LUNs, try:&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;- - -&amp;quot; &amp;gt; /sys/class/scsi_host/host3/scan&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://www.usenet-forums.com/linux-general/79392-hd-online-without-reboot.html hd online without a reboot - Usenet Forums]&lt;br /&gt;
:&amp;quot;download http://www.garloff.de/kurt/linux/rescan-scsi-bus.sh and use that shell&lt;br /&gt;
script to rescan the SCSI bus and pick up any new devices that have been&lt;br /&gt;
attached. Try it with the --help option first so you know everything&lt;br /&gt;
that it can do.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Just a final note on this one in case someone googles it out...&lt;br /&gt;
&lt;br /&gt;
The script mentioned by Dances With QuestionMarks actually scans the bus&lt;br /&gt;
but then uses the echo method of bringing the scsi device online in the kernel.&lt;br /&gt;
If you want to bring a single device online or more take a device offline&lt;br /&gt;
the actual commands are listed below.&lt;br /&gt;
&lt;br /&gt;
Don&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
From the SCSI Programmers Guide:&lt;br /&gt;
&lt;br /&gt;
To remove a SCSI device:&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;scsi remove-single-device a b c d&amp;quot; &amp;gt; /proc/scsi/scsi&lt;br /&gt;
&lt;br /&gt;
and similar, to add a SCSI device, do&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;scsi add-single-device a b c d&amp;quot; &amp;gt; /proc/scsi/scsi&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
a == hostadapter id (first one being 0)&lt;br /&gt;
b == SCSI channel on hostadapter (first one being 0)&lt;br /&gt;
c == ID&lt;br /&gt;
d == LUN (first one being 0)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://lists.centos.org/pipermail/centos/2008-July/059903.html CentOS - Rescan /dev/sd* without reboot?]&lt;br /&gt;
 echo &amp;quot;- - -&amp;quot; &amp;gt; /sys/class/scsi_host/host?/scan&lt;br /&gt;
replacing ? with the proper scsi/fiberchannel host channel #&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://sysdigg.blogspot.com/2008/03/add-san-disks-on-rhel-without-reboot.html sysdigg: Add SAN disks on RHEL without reboot]&lt;br /&gt;
:&amp;quot;On HP Proliant or HP blade server running Red Hat Enterprise Linux 4 (AS/ES) SAN disks or newly created LUN can be added on the fly without doing Linux reboot. Since HP proliant uses Qlogic HBA make sure you have latest Qlogic driver installed on your Red Hat enterprise Linux server. &amp;quot;&lt;br /&gt;
:&amp;quot;Rescan your qlogic HBA&amp;#039;s&amp;quot;&lt;br /&gt;
 echo &amp;quot;scsi-qlascan&amp;quot; &amp;gt; /proc/scsi/&amp;lt;driver-name&amp;gt;/&amp;lt;adapter-id&amp;gt;&lt;br /&gt;
 echo &amp;quot;scsi add-single-device 0 1 2 3&amp;quot; &amp;gt;/proc/scsi/scsi&lt;br /&gt;
 echo &amp;quot;scsi-qlascan&amp;quot; &amp;gt; /proc/scsi/qla2200/1&lt;br /&gt;
 echo &amp;quot;scsi-qlascan&amp;quot; &amp;gt; /proc/scsi/qla2200/2&lt;br /&gt;
 echo &amp;quot;scsi add-single-device 1 0 0 6&amp;quot; &amp;gt;/proc/scsi/scsi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://groups.google.com/group/linux.scsi.ncr53c8xx/browse_thread/thread/4037e3d4b9caa3b3 rescan the SCSI-Bus without reboot - linux.scsi.ncr53c8xx | Google Groups]:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Activate cdr drive if it was off.&lt;br /&gt;
#      * Usage: echo &amp;quot;scsi add-single-device 0 1 2 3&amp;quot; &amp;gt;/proc/scsi/scsi&lt;br /&gt;
#      * with  &amp;quot;0 1 2 3&amp;quot; replaced by your &amp;quot;Host Channel Id Lun&amp;quot;.&lt;br /&gt;
#      * Consider this feature BETA.&lt;br /&gt;
#      *     CAUTION: This is not for hotplugging your peripherals. As&lt;br /&gt;
#      *     SCSI was not designed for this you could damage your&lt;br /&gt;
#      *     hardware !                                                  &lt;br /&gt;
echo &amp;quot;scsi add-single-device 1 0 6 0&amp;quot; &amp;gt;/proc/scsi/scsi&lt;br /&gt;
&lt;br /&gt;
Note that I have 2 scsi cards, you probably want a host of 0. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://www.garloff.de/kurt/linux/ Kurt Garloff - Linux: My Contributions to free software]&lt;br /&gt;
&lt;br /&gt;
Rescan SCSI bus&lt;br /&gt;
Linux allows you to add and remove SCSI devices without rebooting by using the echo &amp;quot;scsi add-single-device H C I L&amp;quot; &amp;gt; /proc/scsi/scsi command (H = host, C = channel, I = SCSI ID, L = SCSI LUN). The remove-single-device command works similarily.&lt;br /&gt;
Note, however, that the SCSI bus was NOT designed for hot-plugging, so you might be out of luck ... And you have to be sure, that termination is OK. All filesystems on a device have to be unmounted before disconnecting it or powering it down.&lt;br /&gt;
&lt;br /&gt;
I use the script rescan-scsi-bus.sh to do this.&lt;br /&gt;
&lt;br /&gt;
[http://www.garloff.de/kurt/linux/rescan-scsi-bus.sh-1.29 v1.29] (2008-10-29)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://kbase.redhat.com/faq/docs/DOC-1724 Red Hat Knowledgebase: How do I get the kernel to recognize a hot-added SCSI drive or change the logging/dump detail level for the SCSI sub-system?]:&lt;br /&gt;
&lt;br /&gt;
Symptom: You have a SCSI controller and the kernel does not see a newly added SCSI drive.&lt;br /&gt;
&lt;br /&gt;
Solution:&lt;br /&gt;
&lt;br /&gt;
Rebooting the system is still the only supported method for adding a new SCSI device to a running system.&lt;br /&gt;
&lt;br /&gt;
Assuming that you have the necessary permissions for writing to /proc/scsi/scsi. The following are some individual commands available for viewing/manipulating scsi controllers and devices:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
*echo &amp;quot;scsi add-single-device &amp;lt;H&amp;gt; &amp;lt;C&amp;gt; &amp;lt;I&amp;gt; &amp;lt;L&amp;gt;&amp;quot; &amp;gt; /proc/scsi/scsi where &amp;lt;H&amp;gt; &amp;lt;C&amp;gt; &amp;lt;I&amp;gt; &amp;lt;L&amp;gt; represents&lt;br /&gt;
 Host &amp;lt;H&amp;gt;, Channel &amp;lt;C&amp;gt;, Id &amp;lt;I&amp;gt;, and Lun &amp;lt;L&amp;gt;. Will add the device specified so that it is accessible&lt;br /&gt;
 to the system.&lt;br /&gt;
&lt;br /&gt;
*echo &amp;quot;scsi remove-single-device &amp;lt;H&amp;gt; &amp;lt;C&amp;gt; &amp;lt;I&amp;gt; &amp;lt;L&amp;gt;&amp;quot; &amp;gt; /proc/scsi/scsi where &amp;lt;H&amp;gt; &amp;lt;C&amp;gt; &amp;lt;I&amp;gt; &amp;lt;L&amp;gt; represents&lt;br /&gt;
 Host &amp;lt;H&amp;gt;, Channel &amp;lt;C&amp;gt;, Id &amp;lt;I&amp;gt;, and Lun &amp;lt;L&amp;gt;. Will remove the device specified so that it is no&lt;br /&gt;
 longer accessible to the system.&lt;br /&gt;
&lt;br /&gt;
*echo &amp;quot;scsi scan-new-devices&amp;quot; &amp;gt; /proc/scsi/scsi will scan all host adapters again to see if there are&lt;br /&gt;
 any new devices.&lt;br /&gt;
&lt;br /&gt;
*echo &amp;quot;scsi dump &amp;lt;#&amp;gt;&amp;quot; &amp;gt; /proc/scsi/scsi will dump the status of all current SCSI commands. &amp;lt;#&amp;gt; is the&lt;br /&gt;
 number specifing the level of detail for the dump, 0-9 are valid.&lt;br /&gt;
&lt;br /&gt;
*echo &amp;quot;scsi log &amp;lt;T&amp;gt; &amp;lt;#&amp;gt;&amp;quot; &amp;gt; /proc/scsi/scsi will change the detail level of SCSI logging represented&lt;br /&gt;
 by &amp;lt;T&amp;gt; of error, scan, mlqueue, mlcomplete, llqueue, llcomplete, hlqueue, or hlcomplete, to the level&lt;br /&gt;
 specified by the &amp;lt;#&amp;gt; number. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== scu ==&lt;br /&gt;
&lt;br /&gt;
SCSI Command Utility (scu) - http://www.scsifaq.org/RMiller_Tools/scu.html&lt;br /&gt;
&lt;br /&gt;
scu Command Summary - http://www.scsifaq.org/RMiller_Tools/scu/scu-scsi-summary.pdf&lt;br /&gt;
&lt;br /&gt;
If trying to run on 64bit:&lt;br /&gt;
 yum install glibc.i686&lt;br /&gt;
&lt;br /&gt;
Quick installation:&lt;br /&gt;
 cd ~&lt;br /&gt;
 wget http://www.scsifaq.org/RMiller_Tools/ftp/linux/intel-scu.tar.gz&lt;br /&gt;
 tar -zvxf intel-scu.tar.gz&lt;br /&gt;
 cd scu.d&lt;br /&gt;
 ln -s ~/scu.d/scu /usr/local/bin/scu&lt;br /&gt;
&lt;br /&gt;
Help:&lt;br /&gt;
 ./scu help&lt;br /&gt;
&lt;br /&gt;
Select device:&lt;br /&gt;
 ./scu -f /dev/sdb&lt;br /&gt;
&lt;br /&gt;
Execute a command from shell: (will return a non-zero errcode on failure)&lt;br /&gt;
 scu -f /dev/sdc show capacity&lt;br /&gt;
&lt;br /&gt;
General Commands:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
show version     # show scu version&lt;br /&gt;
&lt;br /&gt;
exit             # exit scu&lt;br /&gt;
quit             # exit scu&lt;br /&gt;
&lt;br /&gt;
switch /dev/sdb  # switch devices&lt;br /&gt;
&lt;br /&gt;
pwd              # print working device&lt;br /&gt;
show nexus       # print working device&lt;br /&gt;
&lt;br /&gt;
tur              # test unit ready&lt;br /&gt;
&lt;br /&gt;
show capacity    # show disk capacity&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Can use short versions:&lt;br /&gt;
 sw - switch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat &amp;gt; scu-test &amp;lt;&amp;lt;EOF&lt;br /&gt;
&lt;br /&gt;
set debug on&lt;br /&gt;
pwd&lt;br /&gt;
&lt;br /&gt;
show edt&lt;br /&gt;
show edt cap&lt;br /&gt;
show edt status&lt;br /&gt;
show edt serial&lt;br /&gt;
&lt;br /&gt;
show nexus&lt;br /&gt;
show capacity&lt;br /&gt;
show edt lun 0&lt;br /&gt;
show pages&lt;br /&gt;
show inquiry&lt;br /&gt;
show mode&lt;br /&gt;
show inquiry pages supported&lt;br /&gt;
&lt;br /&gt;
show log pages supported&lt;br /&gt;
show log pages&lt;br /&gt;
zero log pages&lt;br /&gt;
show log page overrun&lt;br /&gt;
show log pages all&lt;br /&gt;
&lt;br /&gt;
rezero&lt;br /&gt;
&lt;br /&gt;
show capacity&lt;br /&gt;
verify media starting 409700 dbbr on&lt;br /&gt;
verify media starting 1000 length 1024&lt;br /&gt;
&lt;br /&gt;
show defects grown&lt;br /&gt;
&lt;br /&gt;
show sense&lt;br /&gt;
&lt;br /&gt;
time format defects primary options dcrt&lt;br /&gt;
time format defects primary options immed&lt;br /&gt;
&lt;br /&gt;
write same starting 4100000 bs 1m&lt;br /&gt;
write media starting 4110000 popts lbdata&lt;br /&gt;
read media starting 4110000 popts lbdata&lt;br /&gt;
&lt;br /&gt;
dump media lba 4110000&lt;br /&gt;
eval 0x003eb6b0&lt;br /&gt;
&lt;br /&gt;
mbad lba 4110400&lt;br /&gt;
mbad lba 4110400 hard&lt;br /&gt;
write media lba 4110400&lt;br /&gt;
read media lba 4110400 compare off&lt;br /&gt;
read media bs 1m limit 10m compare off&lt;br /&gt;
read media bs 64k limit 11m errors 1&lt;br /&gt;
&lt;br /&gt;
show stats&lt;br /&gt;
set stats on&lt;br /&gt;
read media bs 1m limit 100m compare off&lt;br /&gt;
read media starting 1000 length 1024&lt;br /&gt;
&lt;br /&gt;
show scsi key 6&lt;br /&gt;
show scsi status 0x28&lt;br /&gt;
&lt;br /&gt;
show paths all&lt;br /&gt;
show paths all cap&lt;br /&gt;
&lt;br /&gt;
show inquiry pages supported&lt;br /&gt;
show inquiry pages&lt;br /&gt;
show inquiry page serial&lt;br /&gt;
&lt;br /&gt;
show edt bus 0 target 1 lun 0 full&lt;br /&gt;
&lt;br /&gt;
show luns&lt;br /&gt;
&lt;br /&gt;
# test unit ready&lt;br /&gt;
tur&lt;br /&gt;
&lt;br /&gt;
test memory&lt;br /&gt;
test selftest&lt;br /&gt;
&lt;br /&gt;
exit&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
cat scu-test | ./scu -f /dev/sdb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
scu-scsi-summary.pdf - http://www.scsifaq.org/RMiller_Tools/scu/scu-scsi-summary.pdf&lt;br /&gt;
&lt;br /&gt;
== other scsi tools ==&lt;br /&gt;
&lt;br /&gt;
* The Linux SCSI Generic (sg) Driver - http://sg.danny.cz/sg/&lt;br /&gt;
* Linux sg3_utils package - http://sg.danny.cz/sg/sg3_utils.html&lt;br /&gt;
* The Linux SCSI Generic (sg) HOWTO - http://www.tldp.org/HOWTO/SCSI-Generic-HOWTO/&lt;br /&gt;
&lt;br /&gt;
== keywords ==&lt;br /&gt;
&lt;br /&gt;
[[Category:Linux]]&lt;/div&gt;</summary>
		<author><name>Kenneth</name></author>
	</entry>
</feed>