Account Links: Cart | Register | Log In

Skip to content

Red Hat Knowledgebase
Red Hat Knowledgebase Search
Article translations:
Currently Being Moderated

How do I rescan the SCSI bus to add or remove a SCSI device without rebooting the computer?

Article ID: 3942 - Created on: Mar 12, 2006 6:00 PM - Last Modified:  Sep 25, 2009 3:45 PM

Release Found: Red Hat Enterprise Linux 3, 4, or 5

 

Problem

It is possible to add or remove a SCSI device explicitly, or to re-scan an entire SCSI bus without rebooting a running system.  Prior to using these commands, please also see the Online Storage Reconfiguration Guide for a complete overview of this topic on Red Hat Enterprise Linux 5.

 

Disclaimer

Technical support for online storage reconfiguration is only provided on Red Hat Enterprise Linux 5. Limited tools for hot adding and removing storage are present in previous releases of Red Hat Enterprise Linux however they cannot be guaranteed to work correctly in all configurations.  Red Hat Enterprise Linux 5 includes many ehancements to udev, the low level device drivers, SCSI midlayer, and device-mapper multipath which enables comprehensive support for online storage reconfiguration.

 

Caution

Issuing a Fibre Channel LIP (loop initialization primitive) or rescanning a SCSI interconnect will cause the operating system to update its state regarding all devices on the interconnect. This can cause devices to be removed or added.                                          
                                                                               
Before you issue any command that will cause a device to be removed from the operation system, you must close all users of the device and unmount any file systems that mounted the device. In addition, remove the device from any dm, md, LVM, multipath or RAID devices using it.


Solution

For Red Hat Enterprise Linux 5

 

With fibre attached storage, it is possible to issue a LIP (loop initialization primitive) on the fabric:

 

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

 

Issuing a LIP (above) on Red Hat Enterprise Linux 5 is all that is needed to rescan fibre attached storage.  Once the LIP is issued, the bus scan may take a few seconds to complete.  Note that under specific types of SAN environments this will cause all attached drives to be reset.  Although present on previous releases, this feature is only fully supported in Red Hat Enterprise Linux 5.

 

Also note that A LIP may disrupt outstanding I/O on the interconnect. It is strongly recommended that you test these procedures in your environment to ensure that the recovery delays are tolerated properly.

 

For Red Hat Enterprise Linux 4 and 5

 

With other SCSI attached storage, a rescan can be issued:

 

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

 

Replace the # with the number of the SCSI bus to be rescanned.

 

In addition to re-scanning the entire bus, a specific device can be added or deleted for some

versions or Red Hat Enterprise Linux as specified below.

 

 

For Red Hat Enterprise Linux 4 or 5

To remove a single existing device explicitly

 

# echo 1 > /sys/block/<dev>/device/delete

 

Please remember to unmount filesystems on this device prior to running this command.

 

For Red Hat Enterprise Linux 3, 4, or 5

To add a single device explicitly:

 

# echo "scsi add-single-device <H> <B> <T> <L>" > /proc/scsi/scsi

 

To remove a device explicitly:

 

# echo "scsi remove-single-device <H> <B> <T> <L>" > /proc/scsi/scsi

 

Where <H> <B> <T> <L> are the host, bus, target, and LUN numbers for the device,as reported in /sys (2.6 kernels only) or /proc/scsi/scsi or dmesg.

 

These numbers are sometimes refered to as "Host", "Channel", "Id", and "Lun" in Linux tool output and documentation.  Again, please remember to unmount filesystems on this device prior to running this command.

 

Considerations for Virtual Guests

The procedures above also apply to hypervisors (i.e. dom0 in Red Hat Enterprise Linux 5 virtualization), but the procedures are different for dynamically altering the storage of running virtual guests. For more information about adding storage to virtual guests, see the Virtualization Guide.

 

Note for Hewlett-Packard SmartArray Controllers

 

Hewlett-Packard SmartArray controllers and other hardware that uses the cciss driver provide a different interface for manipulating SCSI devices.  Users of this hardware can find a similar guide here

Feedback from users like yourself is a critical factor in helping us make the Red Hat Knowledgebase as useful as possible.

More Like This

  • Retrieving data ...