Rescan storage command in Linux CentOS

There are many posts on how to do this, pasting my notes around it here. I just added 3 disks to my Linux CentOS vm and I needed to locate them. I knew I could do a restart and they would show up but was trying to find a way to rescan without a reboot.

All SCSI disks in Linux show up under /dev/ directory and start with sd*. I did a quick ‘ls -la /dev/ | grep sd’ in that folder but was only seeing the sda,sda1,sda2. Running ‘fdisk -l’ and ‘mount -l’ I could see the disks/partitions are mounted and accounted for so they are not the disks I just added.

Anyways to rescan a disk you need to issue a re-scan command as seen below, more info from RedHat is available here. The command sends 3 wildcards – – – which represents the channel number, SCSI target ID, and LUN and that issues a rescan. I wasn’t sure which host# to run the rescan on as the /sys/class/scsi_host/ had three folders with different host numbers, in my case it was host1 but i rescanned all 3 anyways.

Rescan SCSi Storage on a Linux VM

#echo "- - -" > /sys/class/scsi_host/host0/scan
#echo "- - -" > /sys/class/scsi_host/host1/scan
#echo "- - -" > /sys/class/scsi_host/host2/scan

Now I am able to see the 3 disks labeled sdb,sdc,sdd

# ls /dev/ | grep -i sd
sda
sda1
sda2
sdb
sdc
sdd

I can also see them by running fdisk -l, last 3 disks

[root@localhost dev]# fdisk -l

Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c128a

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64        5222    41430016   8e  Linux LVM

Disk /dev/mapper/vg_livecd-lv_root: 40.3 GB, 40340815872 bytes
255 heads, 63 sectors/track, 4904 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg_livecd-lv_swap: 2080 MB, 2080374784 bytes
255 heads, 63 sectors/track, 252 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/sdc: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
This entry was posted in Linux and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *