Scan Linux server for new drives / disks

269ac00f765508cb74b25d006dbf5bb2

Written by Dennis Nind

Last published at: May 3rd, 2019

you have to scan all hosts there is full command with loop on one line (please change the range 0-32 if you have different – just list /sys/class/scsi_host/ ):

for i in `seq 0 32`; do echo "- - -" | sudo tee /sys/class/scsi_host/host$i/scan; ls /dev/sd* ; done

and the result:

$ for i in `seq 1 32`; do echo "- - -" | sudo tee /sys/class/scsi_host/host$i/scan; ls /dev/sd* ; done - - - /dev/sda  /dev/sda1  /dev/sda2  /dev/sdb  /dev/sdb1  /dev/sdc  /dev/sdc1 - - - /dev/sda  /dev/sda1  /dev/sda2  /dev/sdb  /dev/sdb1  /dev/sdc  /dev/sdc1     ︙  thirty two times ;-) 
- - - /dev/sda  /dev/sda1  /dev/sda2  /dev/sdb  /dev/sdb1  /dev/sdc  /dev/sdc1 - - - /dev/sda  /dev/sda1  /dev/sda2  /dev/sdb  /dev/sdb1  /dev/sdc  /dev/sdc1 - - - /dev/sda  /dev/sda1  /dev/sda2  /dev/sdb  /dev/sdb1  /dev/sdc  /dev/sdc1  /dev/sdd  /dev/sdd1

The last line shows us /dev/sdd device was discovered.