Sometimes I needed to move the harddisk between servers. Removing or adding hardisks normally requires system reboot.
But I used this way to remove or add disk without rebooting:
echo 'scsi remove-single-device 0 0 1 0' > /proc/scsi/scsi
echo 'scsi add-single-device 0 0 1 0' > /proc/scsi/scsi
Recently I was asked to add a new harddisk without reboot system. It's a Redhat in VMware, as I was not managing VMware, so not clear about the hostadaptor, SCSI channel, ID, LUN, manipulating /proc/scsi/scsi may not work.
After searching around I found that I can let system to rescan the SCSI bus.
for scsi_host in /sys/class/scsi_host/host*
echo '- - -' > $scsi_host/scan
After this, I could see the new hard disk was spinned up in /var/log/message.
Besides 'scsi remove-single-device 0 0 1 0', we can also do it in this way to remove a hard disk.
echo 1 > /sys/block/sdb/device/delete