LINUX and WINDOWS - Rescanning your SCSI Bus to see new Storage (drive disk) thats been added to VM virtual machine VMware whatever

COPY OF SITE - I have an OCD thing about thinking peoples sites might be down one day, so I copy paste the material out, but I still give full credit where its due, in this case its all due to the owner of the site: INSERT-URL-HERE - In no way am I claiming this as my own information, this is just a reference to a good site that I wanted to share, plus it probably increase that sites hits - If this is something bad and you dont want me to include this, let me know my contact information is all over this blog. opps@kossboss.com will get to me.

SOURCE: https://blogs.it.ox.ac.uk/oxcloud/2013/03/25/rescanning-your-scsi-bus-to-see-new-storage/

Rescanning your SCSI Bus to see new Storage (disk drive)
#########################################################

If added new storage to a running VM. You will not see it, because the SCSI bus to which the storage is connected needs to be rescanned.

My way
#######

cd /sys/class/scsi_host/
ls

note that you see host0 and host1 and host2

We dont need to scan all the controller but it doesnt hurt to

echo "- - -" > /sys/class/scsi_host/host0/scan

cat /proc/partitions

If you see your new drive you can stop, otherwise continue to host1

echo "- - -" > /sys/class/scsi_host/host1/scan

cat /proc/partitions

and so on

LINUX
#####

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

NOTE: in article it says "echo "- - -" > /sys/class/scsi_host/host0" which is incorrect its missing the scan part

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
Comments