Solaris script to scan FiberChannel bus for new LUN

Here is a script that I use to re-scan the FiberChannel bus for new or removed volumes on Solaris 10.

WARNING!: This script works for me, but use it at your own risk! Make sure you look through the script and make sure it doesn’t do anything that would be unusual on your system. I take no responsibility if you use this script and it erases all of your production data. :)

#!/bin/sh

# This will scan the Fiber Channel bus on Solaris servers

# using cfgadm and then run devfsadm -C.

# I *think* I’ve got it set up so that it will autodetect

# the controller # that the HBA is recognized as.

# Usually it’s c2 and c4, but it might be different.

 

CONTROLLER=”UNSET”

for CONTROLLER in `/usr/sbin/cfgadm -al | grep fc-fabric | grep connected | grep

configured | awk ‘{print $1}’`; do

        if [ ${CONTROLLER} = “UNSET” ]; then

                echo “”

                echo “No Fiber HBA Controllers found.”

                exit 1

        fi

        echo “”

        echo “Scanning FC Bus on Controller ${CONTROLLER}…”

        cfgadm -o force_update -c configure ${CONTROLLER}

done

 

echo ” “

echo “Reconfiguring devices…”

/usr/sbin/devfsadm -C

 

echo “”

echo “FC Bus scan complete.”

Leave a Comment

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

CAPTCHA * Time limit is exhausted. Please reload the CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top