rescan-scsi-bus.sh script is from sg3_utils package, which can automatically update the logical unit configuration of the host as needed (after a device has been added to the system).

The rescan-scsi-bus.sh script can also perform an issue_lip on supported devices.

rescan-scsi-bus.sh default run

By default, it will scan SCSI subsystem for new devices

# /usr/bin/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
 Calling udevadm settle (can take a while)
                                           
 Scanning for device 0 0 0 0 ...
OLD: Host: scsi0 Channel: 00 Id: 00 Lun: 00
      Vendor: ServeRA  Model: 8k-l Mirror      Rev: V1.0
      Type:   Direct-Access                    ANSI SCSI revision: 02
 Scanning for device 0 1 0 0 ...
NEW: Host: scsi0 Channel: 01 Id: 00 Lun: 00
...
 Calling udevadm settle (can take a while)
                                           
 Scanning for device 0 3 0 0 ...
OLD: Host: scsi0 Channel: 03 Id: 00 Lun: 00
      Vendor: IBM-ESXS Model: VSC7160          Rev: 1.06
      Type:   Enclosure                        ANSI SCSI revision: 03
Scanning host 1 for  SCSI target IDs  0 1 2 3 4 5 6 7, all LUNs
Scanning host 2 for  SCSI target IDs  0 1 2 3 4 5 6 7, all LUNs
 Calling udevadm settle (can take a while)
2 new or changed device(s) found.          
    [0:1:0:0]
    [0:1:1:0]
0 remapped or resized device(s) found.        
0 device(s) removed.

rescan-scsi-bus.sh -a, scan all target

# /usr/bin/rescan-scsi-bus.sh -a 
Scanning SCSI subsystem for new devices
Scanning host 0 for  SCSI target IDs  0 1 2 3 4 5 6 7, all LUNs
 Calling udevadm settle (can take a while)
                                           
 Scanning for device 0 0 0 0 ...

rescan-scsi-bus.sh -d, enable debug

# /usr/bin/rescan-scsi-bus.sh -d 
Host adapter 0 (aacraid) found.
Host adapter 1 (ata_piix) found.
Host adapter 2 (ata_piix) found.
Host adapter 3 (qla2xxx) found.
Host adapter 4 (qla2xxx) found.
Scanning SCSI subsystem for new devices
Scanning host 0 for  SCSI target IDs  0 1 2 3 4 5 6 7, all LUNs
 Calling udevadm settle (can take a while)
...

Just like verbose output, handy when diagnosis SCSI subystem problem.

rescan-scsi-bus.sh -f, enable debug

To flush failed ultipath devices, run rescan-scsi-bus.sh with -f

#rescan-scsi-bus.sh -f

rescan-scsi-bus.sh -s, look for resized disks

#/usr/bin/rescan-scsi-bus.sh -s | more
Scanning SCSI subsystem for new devices
Searching for resized LUNs
0 new or changed device(s) found.          
0 remapped or resized device(s) found.        
0 device(s) removed.   

rescan-scsi-bus.sh -i, issue a FibreChannel LIP reset

#/usr/bin/rescan-scsi-bus.sh -i

For more information about how to use this script, refer to rescan-scsi-bus.sh --help.

# /usr/bin/rescan-scsi-bus.sh --help
Usage: rescan-scsi-bus.sh [options] [host [host ...]]
Options:
 -a      scan all targets, not just currently existing [default: disabled]
 -d      enable debug                       [default: 0]
 -l      activates scanning for LUNs 0--7   [default: 0]
 -L NUM  activates scanning for LUNs 0--NUM [default: 0]
 -w      scan for target device IDs 0--15   [default: 0--7]
 -c      enables scanning of channels 0 1   [default: 0 / all detected ones]
 -r      enables removing of devices        [default: disabled]
 -f      flush failed multipath devices     [default: disabled]
 -i      issue a FibreChannel LIP reset     [default: disabled]
 -u      look for existing disks that have been remapped
 -s      look for resized disks and reload associated multipath devices, if applicable
--alltargets:    same as -a
--remove:        same as -r
--flush:         same as -f
--issue-lip:     same as -i
--wide:          same as -w
--forcerescan:   Rescan existing devices
--forceremove:   Remove and readd every device (DANGEROUS)
--nooptscan:     don't stop looking for LUNs is 0 is not found
--color:         use coloured prefixes OLD/NEW/DEL
--hosts=LIST:    Scan only host(s) in LIST
--channels=LIST: Scan only channel(s) in LIST
--ids=LIST:      Scan only target ID(s) in LIST
--luns=LIST:     Scan only lun(s) in LIST
--sync/nosync:   Issue a sync / no sync [default: sync if remove]
--attachpq3:     Tell kernel to attach sg to LUN 0 that reports PQ=3
--reportlun2:    Tell kernel to try REPORT_LUN even on SCSI2 devices
--largelun:      Tell kernel to support LUNs > 7 even on SCSI2 devs
--sparselun:     Tell kernel to support sparse LUN numbering
--update:        same as -u
--resize:        same as -s
 Host numbers may thus be specified either directly on cmd line (deprecated) or
 or with the --hosts=LIST parameter (recommended).
LIST: A[-B][,C[-D]]... is a comma separated list of single values and ranges  (No spaces allowed.)

Known Issues With rescan-scsi-bus.sh

When using the rescan-scsi-bus.sh script, take note of the following known issues:
In order for rescan-scsi-bus.sh to work properly, LUN0 must be the first mapped logical unit. The rescan-scsi-bus.sh can only detect the first mapped logical unit if it is LUN0 .

The rescan-scsi-bus.sh will not be able to scan any other logical unit unless it detects the first mapped logical unit even if you use the --no optscan option.
A race condition requires that rescan-scsi-bus.sh be run twice if logical units are mapped for the first time. D uring the first scan, rescan-scsi-bus.sh only adds LUN0 ; all other logical units are added in the second scan.

A bug in the rescan-scsi-bus.sh script incorrectly executes the functionality for recognizing a change in logical unit size when the --remove option is used.
The rescan-scsi-bus.sh script does not recognize ISCSI logical unit removals.