Tag Archives: scan

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. :)


# 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.



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


        echo “”

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

        cfgadm -o force_update -c configure ${CONTROLLER}



echo ” “

echo “Reconfiguring devices…”

/usr/sbin/devfsadm -C


echo “”

echo “FC Bus scan complete.”

Solaris Dynamically New LUN addition / Scan to a new target ID

When new group of LUNS is mapped to the host by multiple HBA ports. An OS device scan is issued for the LUNs to be recognized and added to DMP control.

To perform online LUN addition

  1. Identify the LUNs to be added.Use Storage Array Management to identify the IDs for the above LUNs.
  2. Map/Mask the concerned LUNs to the new target IDs on multiple host ports.
  3. Perform a Solaris device scan. For example:
    #cfgadm -c configure c2
    #cfgadm -c configure c3
    #devfsadm -Cv

    Repeat step 1 to step 2 until the required # of LUNs are visible.

  4. If required, write an OS Label on the LUNs using the fmthard command.
  5. Perform a device scan with Volume Manager:
    # vxdctl enable
  6. Verify that the devices are correctly added by answering the following questions:

    • Do the correct number of LUNs appear in vxdisk list?
    • Are there multiple paths for each LUN?

    If the answer to any of these questions is no, you need to clean up the device tree.

    You also need to clean up the device tree if the following message displays:

    V-5-1-13788 Data Corruption Protection Activated - User Corrective Action Needed
    vxvm:vxconfigd: [ID 702911 daemon.notice] V-5-1-13789 LUN serial number 6005076306FFC528000000000000112D of old node c3t50050 76306184528d11 does not match with LUN serial number 6005076306FFC528000000000000112F of new node c3t5005076306184528d11 even though both have same device number 118/376

    The above message indicates that a new LUN is attempting to reuse the target ID of an older LUN. The device entries have not been cleaned, so the new LUN cannot use the target ID. DMP prevents this operation until the OS device tree is cleaned up.