Quick way to rescan HBA from command line for disk changes
Here is a quick way to rescan HBA’s from command line for new LUN’s without needing to reboot:
[root@ultra iscsi]# cat scan_hba.sh
#!/usr/bin/env bash
set -Eeuo pipefail
for HBA in /sys/class/scsi_host/host*/scan
do
echo "- - -" > ${HBA}
done
The following script will rescan existing SCSI devices for size change:
[root@ultra iscsi]# cat scan_disk.sh
#!/usr/bin/env bash
set -Eeuo pipefail
for DISK in /sys/block/sd*/device/rescan
do
echo "- - -" > ${DISK}
done