If you have added new storage to a running VM, 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.
How you rescan the SCSI bus depends on the operating system your Virtual Machine is running.
Instructions for common supported operating systems are as follows, these assume you have root or suitable privileges.
Linux, when adding a new disc
First find your host bus number
grep mpt /sys/class/scsi_host/host?/proc_name
Which should return a line like
/sys/class/scsi_host/host0/proc_name:mptspi
where host0 is the relevant field.
use this to rescan the bus with the following command
echo "- - -" > /sys/class/scsi_host/host0/scan
In the above command the the hyphens represent controller,channel,lun, so – – – indicates all controllers, all channels and all luns should be scanned.
Linux, when expanding an existing disc
Assuming you know the device name of the disc you have expanded (eg /dev/sda) then you can simply issue the following command to force the rereading of the disk geometry. NOte that this is not 100% reliable with LVM on older kernels but should work with current kernels
echo 1 > /sys/class/scsi_device/device/rescan
Windows Server
Windows should pickup the change in discs regardless of you adding or expanding discs however if not you can either use the gui or the command line to force this. Note that expanding the boot device will typically always require a reboot, and will require you to boot from an alternative boot device (a boot CD image) to actually expand the windows boot partition. All these method assume you are an administrator on the system.
GUI method – Server 2003
Open Computer Management (Local).
In the console tree, click Computer Management (Local), click Storage, and then click Disk Management.
Click Action, and then click Rescan Disks.
GUI method server 2008
Open Server Manager.
In the tree pane, double-click the Storage node, and select Disk Management.
Right-click Disk Management and select Rescan Disks.
Command line method
as an administrator, start a command prompt and type
diskpart
at the diskpart prompt, type
rescan
On the expansion, you actually need to echo “- – -” to /sys/class/scsi_host/*/scan, not just the hostN softlink.
Thanks!
Command
‘echo “- – -” > /sys/class/scsi_host/host0’
shoud be read
‘echo “- – -” > /sys/class/scsi_host/host0/scan’
shouldn’t it?
Thanks for the catch, guys – post updated!
# dpkg -S /usr/bin/scsi_logging_level
sg3-utils: /usr/bin/scsi_logging_leve
# scsi_logging_level –hlqueue 3 –highlevel 2 –all 1 -s
New scsi logging level:
/proc/sys/dev/scsi/logging_level = 174363209
SCSI_LOG_ERROR=1
SCSI_LOG_TIMEOUT=1
SCSI_LOG_SCAN=1
SCSI_LOG_MLQUEUE=1
SCSI_LOG_MLCOMPLETE=1
SCSI_LOG_LLQUEUE=1
SCSI_LOG_LLCOMPLETE=1
SCSI_LOG_HLQUEUE=3
SCSI_LOG_HLCOMPLETE=2
SCSI_LOG_IOCTL=1
Or raw:
# echo 12345123123123 > /proc/sys/dev/scsi/logging_level
This enable very noise logging.
# dpkg -S `which rescan-scsi-bus `
scsitools: /sbin/rescan-scsi-bus
# rescan-scsi-bus
/sbin/rescan-scsi-bus: line 592: [: 1.13: integer expression expected
Host adapter 0 (ahci) found.
Host adapter 1 (ahci) found.
Host adapter 2 (ahci) found.
Host adapter 3 (ahci) found.
Host adapter 4 (ahci) found.
Host adapter 5 (ahci) found.
Scanning SCSI subsystem for new devices
Scanning host 0 for SCSI target IDs 0 1 2 3 4 5 6 7, all LUNs
Scanning host 1 for SCSI target IDs 0 1 2 3 4 5 6 7, all LUNs
Scanning for device 1 0 0 0 …
OLD: Host: scsi1 Channel: 00 Id: 00 Lun: 00
Vendor: ATA Model: ST3250312AS Rev: JC4B
Type: Direct-Access ANSI SCSI revision: 05
Scanning host 2 for SCSI target IDs 0 1 2 3 4 5 6 7, all LUNs
Scanning host 3 for SCSI target IDs 0 1 2 3 4 5 6 7, all LUNs
Scanning host 4 for SCSI target IDs 0 1 2 3 4 5 6 7, all LUNs
Scanning for device 4 0 0 0 …
OLD: Host: scsi4 Channel: 00 Id: 00 Lun: 00
Vendor: ATA Model: ST1500DM003-9YN1 Rev: CC4B
Type: Direct-Access ANSI SCSI revision: 05
Scanning host 5 for SCSI target IDs 0 1 2 3 4 5 6 7, all LUNs
Scanning for device 5 0 0 0 …
Rescan the same method you describe.
My cdrom0 stuck on burning, detach / reattach doesn’t help, scanning hang on device, completely lock console. Even `kill -9` can’t help.
Do you know something about re-scanning hang troubles?