Linux Scroll

Just another WordPress.com site

Rescan new SCSI bus in linux

To detect new SCSI disk/dev in linux:

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

# fdisk -l

To detect new SCSI fibre channel disk/LUN in linux:

# echo "1" > /sys/class/fc_host/host#/issue_lip

Script similar to hp_rescan:

#!/bin/bash

# $Id: rescan_hba.sh 48 2008-03-11 12:37:48Z ajo $

# This script will rescan all found FC HBAs for (new) LUNs
# Beware that it will generate failover events (in multipathd for
# instance)

if [ -f /usr/sbin/hp_rescan ]
then
echo "hp_rescan found - use that instead"
exit 0
fi


for host in $(ls -d /sys/class/fc_host/host*)
do
echo "Rescanning $host"
echo 1 > /sys/class/fc_host/$host/issue_lip
sleep 5
echo "- - -" > /sys/class/scsi_host/$host/scan
done
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: