Linux – new storage disk add remove tips

Rescanning SCSI bus to add or remove a disk

If you have added new storage to a running VM / Physical server from SAN/iSCSI, you probably won’t see it. This is because the SCSI bus to which the storage devices are connected needs to be rescanned to make the new hardware visible.

Instructions for common supported operating systems

==> Find new disk or Lun without restart
– First find your host bus number
# cat /sys/class/scsi_host/host?/proc_name | grep mptspi

– Then pass “- – -” to rescan bus
echo “- – -” > /sys/class/scsi_host/host0/scan
– – – indicates all controllers, all channels and all luns should be scanned.
==> Expanding an existing disc
echo 1 > /sys/class/scsi_device/device/rescan

==> Delete a single device called /dev/sdx
An existing device can be deleted using the following command:
# echo 1 > /sys/block/devName/device/delete
# echo 1 > /sys/block/sdx/device/delete

==> Add single device called /dev/sdx
Add a single device explicitly called /dev/sdx?
# echo “scsi add-single-device <H> <B> <T> <L>” > /proc/scsi/scsi
<H> : Host
<B> : Bus (Channel)
<T> : Target (Id)
<L> : LUN numbers

e.g. add /dev/sdx with host # 0, bus # 0, target # 1, and LUN # 2, enter:
# echo “scsi add-single-device 0 0 1 2”>/proc/scsi/scsi
# fdisk -l
# cat /proc/scsi/scsi

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/5/html-single/Online_Storage_Reconfiguration_Guide/ https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/5/html-single/Online_Storage_Reconfiguration_Guide/#rescan-scsi-bus