Sunday, June 15, 2014

Scan and Add SAN disks in Linux (Redhat & Centos) without reboot

This small guide will try to explain how to scan and add SAN disks to a Centos / Redhat server. To detect new disks that been added (zoned) to the server run the following commands.
for i in `seq 0 10`; do echo 1 > /sys/class/scsi_device/device$i/scan; done
for i in `seq 0 10`; do echo "- - -" > /sys/class/scsi_host/host$i/scan; done
The commands will loop thru all scsi_devices and activate a rescan. Note: if scsi_host does not exists, use fc_host instead.

If you have the sg3_utils package installed you can run this instead:
/usr/bin/rescan-scsi-bus.sh -l
But then LUN0 must be the first mapped logical unit for it to work.

To see the newly scanned disks run:
lsscsi 
or
fdisk -l 


If you are using multipath i also recommend you to run this to force a devmap reload:
multipath -r


Check that the new disks shows up with:
multipath -l


Now we can proceed with creating a LVM volume on those disks.

No comments:

Post a Comment

Web Analytics