So you’re in a Linux VM and you need to add a disk, how can you discover the new disk without restarting the machine?
Well first of all it depends on what controller you’re emulating:
SCSI Disks (/dev/sd?):
Disks starting with sd are SCSI disks, SCSI disks are very easy to discover all you need to do is issue the following command
echo “- – -” > /sys/class/scsi_host/host?
where ‘host?’ should be the scsi_adaptor your trying to rescan. However you could do it the lazy way and scan all of the hosts, this doesn’t come without risk and i have had machines hang on me after this
for device in /sys/class/scsi_host/host*; do echo “Scanning: ” $device; echo “- – -” > $device/scan; done
This method works for SATA and SAS disk as well.
IDE Disks (/dev/hd?):
Disks starting with hd are normally IDE disks, IDE disks can technically be refreshed but the methods to do so are a bit of a frig, I would not recommend doing them, better just restart the machine I’m afraid. But if you insist I’ve seen a few pages saying that hotplug might help, google if you must.