Difference between revisions of "/usr/bin/rescan-scsi-bus.sh"

From wikieduonline
Jump to navigation Jump to search
Tags: Mobile web edit, Mobile edit
 
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
<code>rescan-scsi-bus.sh</code><ref>https://github.com/hreinecke/sg3_utils/blob/master/scripts/rescan-scsi-bus.sh</ref> included in <code>[[sg3-utils]]</code> package.
+
<code>/usr/bin/rescan-scsi-bus.sh</code><ref>https://github.com/hreinecke/sg3_utils/blob/master/scripts/rescan-scsi-bus.sh</ref> included in <code>[[sg3-utils]]</code> package.
 
:https://raw.githubusercontent.com/hreinecke/sg3_utils/master/scripts/rescan-scsi-bus.sh
 
:https://raw.githubusercontent.com/hreinecke/sg3_utils/master/scripts/rescan-scsi-bus.sh
:<code>rescan-scsi-bus.sh -h</code>  
+
* <code>rescan-scsi-bus.sh -h</code>
 +
* <code>rescan-scsi-bus.sh --alltargets</code>
 +
* <code>rescan-scsi-bus.sh --remove</code>
  
 +
== Discover new [[block devices]]: rescan-scsi-bus.sh -a ==
 
<pre>
 
<pre>
 
rescan-scsi-bus.sh --alltargets or rescan-scsi-bus.sh -a
 
rescan-scsi-bus.sh --alltargets or rescan-scsi-bus.sh -a
Line 27: Line 30:
 
0 device(s) removed.
 
0 device(s) removed.
 
</pre>
 
</pre>
 +
You may need to execute: <code>multipath -f</code> (flush) to remove unused devices and [[pvresize]] if your [[LUN]] has changed size.
  
 +
:<code>rescan-scsi-bus.sh -i --issue-[[lip]]</code>
  
:<code>rescan-scsi-bus.sh -i --issue-[[lip]]</code>
+
<pre>
 +
Scanning for device 32 0 0 0 ...
 +
OLD: Host: scsi32 Channel: 00 Id: 00 Lun: 00
 +
      Vendor: VMware  Model: Virtual disk    Rev: 2.0
 +
      Type:  Direct-Access                    ANSI SCSI revision: 06
 +
Scanning for device 32 0 1 0 ...
 +
NEW: Host: scsi32 Channel: 00 Id: 01 Lun: 00
 +
      Vendor: VMware  Model: Virtual disk    Rev: 2.0
 +
      Type:  Direct-Access                    ANSI SCSI revision: 06
 +
1 new or changed device(s) found.
 +
[32:0:1:0]
 +
0 remapped or resized device(s) found.
 +
0 device(s) removed.
 +
</pre>
  
 
== Remove block devices: rescan-scsi-bus.sh --remove  ==
 
== Remove block devices: rescan-scsi-bus.sh --remove  ==
Line 51: Line 69:
 
</pre>
 
</pre>
  
Related commands: <code>[[blkid]]</code> <code>[[multipath -f]]</code> <code>[[multipath -w]]</code> <code>[[pvcreate]]</code>
+
== Related commands ==
 +
* <code>[[blkid]]</code>, <code>[[multipath -f]]</code>, <code>[[multipath -w]]</code>, <code>[[pvcreate]]</code>
 +
* [[LVM scan commands]]
  
 
== Activities ==
 
== Activities ==
 
# Understand differences between <code>[[pvscan]]</code> which list all physical volumes and <code>[[rescan-scsi-bus.sh]]</code>
 
# Understand differences between <code>[[pvscan]]</code> which list all physical volumes and <code>[[rescan-scsi-bus.sh]]</code>
 
# Read Change log: https://github.com/hreinecke/sg3_utils/blob/master/scripts/rescan-scsi-bus.sh
 
# Read Change log: https://github.com/hreinecke/sg3_utils/blob/master/scripts/rescan-scsi-bus.sh
 +
# [[Add a new disk]]
  
 
== See also ==
 
== See also ==
 +
* {{HBA}}
 
* {{Linux block devices}}
 
* {{Linux block devices}}
 
* {{Linux Fibre Channel}}
 
* {{Linux Fibre Channel}}

Latest revision as of 11:20, 31 March 2021

/usr/bin/rescan-scsi-bus.sh[1] included in sg3-utils package.

https://raw.githubusercontent.com/hreinecke/sg3_utils/master/scripts/rescan-scsi-bus.sh
  • rescan-scsi-bus.sh -h
  • rescan-scsi-bus.sh --alltargets
  • rescan-scsi-bus.sh --remove

Discover new block devices: rescan-scsi-bus.sh -a[edit]

rescan-scsi-bus.sh --alltargets or rescan-scsi-bus.sh -a
...
...
32 new or changed device(s) found.
0 remapped or resized device(s) found.
0 device(s) removed.
rescan-scsi-bus.sh
Scanning SCSI subsystem for new devices
Scanning host 0 for  SCSI target IDs  0 1 2 3 4 5 6 7, all LUNs
 Scanning for device 0 0 0 0 ...
.../...
Scanning host 1 for  all SCSI target IDs, all LUNs
Scanning host 2 for  SCSI target IDs  0 1 2 3 4 5 6 7, all LUNs
 Scanning for device 2 0 0 0 ...
.../...
Scanning host 3 for  all SCSI target IDs, all LUNs
0 new or changed device(s) found.
0 remapped or resized device(s) found.
0 device(s) removed.

You may need to execute: multipath -f (flush) to remove unused devices and pvresize if your LUN has changed size.

rescan-scsi-bus.sh -i --issue-lip
 Scanning for device 32 0 0 0 ...
OLD: Host: scsi32 Channel: 00 Id: 00 Lun: 00
      Vendor: VMware   Model: Virtual disk     Rev: 2.0
      Type:   Direct-Access                    ANSI SCSI revision: 06
 Scanning for device 32 0 1 0 ...
NEW: Host: scsi32 Channel: 00 Id: 01 Lun: 00
      Vendor: VMware   Model: Virtual disk     Rev: 2.0
      Type:   Direct-Access                    ANSI SCSI revision: 06
1 new or changed device(s) found.
	[32:0:1:0]
0 remapped or resized device(s) found.
0 device(s) removed.

Remove block devices: rescan-scsi-bus.sh --remove[edit]

 View current block devices: lsblk or lsscsi
 rescan-scsi-bus.sh --remove or rescan-scsi-bus.sh -r

sg10 changed: LU not available (PQual 1)
REM: Host: scsi3 Channel: 00 Id: 00 Lun: 07
DEL:  Vendor: NETAPP   Model: LUN C-Mode       Rev: 9600
      Type:   Direct-Access                    ANSI SCSI revision: 05
0 new or changed device(s) found.
0 remapped or resized device(s) found.
4 device(s) removed.

 View block devices after command execution: lsblk or lsscsi

multipath -ll
3600a09803831416c592b4f566453774e dm-3 ##,##
size=250G features='2 pg_init_retries 50' hwhandler='0' wp=rw

Related commands[edit]

Activities[edit]

  1. Understand differences between pvscan which list all physical volumes and rescan-scsi-bus.sh
  2. Read Change log: https://github.com/hreinecke/sg3_utils/blob/master/scripts/rescan-scsi-bus.sh
  3. Add a new disk

See also[edit]

  • https://github.com/hreinecke/sg3_utils/blob/master/scripts/rescan-scsi-bus.sh
  • Advertising: