I added new disk to my running Linux virtual machine.
Is it possible to add a SCSI/SATA device explicitly, or to re-scan an entire SCSI/SATA host bus without rebooting a running Linux?
linuxsatascsi
I added new disk to my running Linux virtual machine.
Is it possible to add a SCSI/SATA device explicitly, or to re-scan an entire SCSI/SATA host bus without rebooting a running Linux?
Best Answer
Yes, it is possible. There are some methods to do it:
Add a single device
In my case, I added the only SCSI/SATA disk on Host=8, so the command is
Rescan SCSI/SATA Host Bus
If there were more than one disks added to your system, you can scan all devices on explicit SCSI/SATA Host
I.e. if the disk was added to Host=8, the command is
Rescan all SCSI/SATA Hosts
Generally, if you don't know a host number of added disk, you can scan the whole SCSI hosts on your machine.
Get a list of SCSI/SATA hosts:
Use lsscsi to get a list of hosts:
lsscsi -H
Use sysfs to get a list of hosts:
ls -d /sys/class/scsi_host/host*
.Rescan given host:
echo "- - -" > /sys/class/scsi_host/hostX/scan
Simple full scan automation script
Sources were used in this answer:
EVAN HOFFMAN'S BLOG
nixCraft
RedHat Customer Portal