Linux system SCSI disk scanning mechanism analysis and command details

Source: Internet
Author: User
Tags file system

Introduced

How many ways do Linux systems scan SCSI disks? After Linux has added LUNs, can you recognize the device without restarting the host? If PowerPath is installed, what is the command to add/Remove LUNs dynamically? This article summarizes the way Linux hosts reconfigure disk devices and attaches command instances.

More information

The Linux system provides multiple mechanisms to rescan the SCSI bus and recognize the SCSI devices that are joined in the system. In the 2.4 kernel scenario, because the dynamic LUN scanning mechanism is not consistent, it is often necessary to interrupt I/O.

In the 2.6 kernel, LUN scanning has been significantly improved and dynamic LUN scanning mechanism has been added. Linux currently lacks commands like drvconfig or Ioscan to allow dynamic SCSI channels to be reset.

The way Linux hosts reconfigure disk devices includes:

◦ Reboot System

◦ Uninstall and reload the HBA driver module

List of SCSI devices under ◦echo/proc

◦ Run a SCSI scan by setting the properties under/sys

◦ SCSI scan via HBA vendor script

System reboot

Restarting a host is a reliable way to detect newly added disk devices. Reboot the host at the end of all I/O stops, and connect the disk driver either statically or in a modular manner. The PCI bus is scanned when the system is initialized, so the SCSI host adapter on which it is mounted is scanned and a PCI device is generated. The scanning software then loads the appropriate driver for the PCI device. When the SCSI host driver is loaded, its probe function initializes the SCSI host, registers the interrupt handler function, and finally calls the Scsi_scan_host function to scan all SCSI buses managed by the SCSI host adapter.

Reload HBA Driver

Typically, the HBA driver is loaded in a module form in the system. This allows the module to be unloaded and reloaded, during which the SCSI scan function is invoked. Typically, all I/O to the SCSI device should be stopped before uninstalling the HBA driver, uninstalling the file system, and the Multipath service application must stop. If you have an agent or HBA Application Help module, you should also abort.

command example:

For example, a server on a RAC node that performs the fdisk–l command does not see the shared disk, you can try the following command:

# modprobe-r LPFC (Uninstall Drive)

# modprobe LPFC (Load driven)

/proc Down SCSI Scan

In the 2.4 kernel, the/proc file system provides a list of available SCSI devices. If the SCSI device is reconfigured in the system, all of these changes are reflected through the Echo/proc interface to the SCSI device. Adding a device, host, Channel,target ID, and the LUN number of the disk device are added to the/proc/scsi/to specify the SCSI number.

command example:

# echo "scsi Add-single-device 0 1 2 3" >/PROC/SCSI/SCSI

0: Host ID

1:channel ID

2:target ID

3:lun number

This command adds a new disk device to the/proc/scsi/scsi file. If you do not find the file, create a device file name for the new disk device in the/dev path.

If you want to delete a disk device, use the appropriate host, Channel,target ID and LUN number to run the following format command:

# echo "scsi Remove-single-device 0 1 2 3" >/PROC/SCSI/SCSI

0: Host ID

1:channel ID

2:target ID

3:lun number

/sys under SCSI scan

In the 2.6 kernel, the HBA driver exports the scan function to the/sys directory, which can be used to rescan SCSI disk devices under the interface. The order is as follows:

# cd/sys/class/scsi_host/host4/

# Ls-al Scan

# echo '--' > Scan

'--' represents the Channel,target and LUN number. The above command will cause all channel,target and visible LUNs under HBA4 to be scanned.

RHEL5 or SUSE10:

Echo '---' >/sys/class/scsi_host/host0/scan

/sys/class/scsi_host/a few host on the following scan several times

RHEL4 or SUSE9:

Echo 1 >>/sys/class/scsi_host/host0/issue_lip

There are several host/sys/class/scsi_host/under the same number of executions

Echo '---' >>/sys/class/scsi_host/host0/scan

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.