Linux , Solaris scan Fiber channel storage , and get LUN ID - unix1998/technical_notes GitHub Wiki
Linux does have tools for scanning Fibre Channel (FC) storage, but unlike Sun Solaris's luxadm, it relies on multiple utilities depending on the specific task. Here's a breakdown of some commonly used commands:
1. lsfacts:
- This command provides information about SCSI devices, including FC HBAs (Host Bus Adapters) connected to your system. It can be used to list basic details like HBA model, firmware version, and attached LUNs (Logical Unit Numbers).
lsfacts | grep hba
2. sg_inq:
- This command is part of the
sg3utils
package and allows you to directly query a specific SCSI device (LUN) for details. You'll need the device name (e.g., /dev/sgX) to use this command effectively.
sg_inq /dev/sg3
3. fcscan:
- This command (part of the
scsi-tools
package) is used to scan for FC HBAs and attached devices. It can be helpful for discovering newly connected storage devices.
fcscan
4. fcinfo:
- This command (also part of the
scsi-tools
package) provides detailed information about FC HBAs and LUNs. It can be used to gather in-depth information about your FC storage configuration.
fcinfo hba
fcinfo host
fcinfo port
fcinfo target
5. lsscsi:
- This command lists all SCSI devices connected to the system, including FC LUNs. It offers a basic overview of attached storage devices.
lsscsi
Choosing the Right Tool:
- For a quick overview of FC HBAs and attached LUNs,
lsfacts
orfcscan
might be sufficient. - For detailed information about specific HBAs, ports, targets, or LUNs, use
fcinfo
with the appropriate arguments. sg_inq
provides low-level details about a specific SCSI device.
In Conclusion:
Linux offers a combination of tools like lsfacts
, sg_inq
, fcscan
, fcinfo
, and lsscsi
to scan and manage FC storage. While it doesn't have a single unified command like Solaris's luxadm, these tools provide comprehensive functionality for discovering, querying, and monitoring your FC storage infrastructure on Linux systems.
and
in Linux, there are several commands and tools that you can use to scan for new Fibre Channel (FC) storage devices. These tools asimilar to how luxadm
works in Solaris.
Here are some of the commonly used tools and commands for scanning FC storage in Linux:
rescan-scsi-bus.sh
1. The rescan-scsi-bus.sh
script is part of the sg3_utils
package, which provides utilities for working with SCSI devices.
-
Install the sg3_utils package:
sudo yum install sg3_utils # For RHEL/CentOS sudo apt-get install sg3-utils # For Debian/Ubuntu
-
Run the rescan-scsi-bus.sh script:
sudo rescan-scsi-bus.sh
2. Manual SCSI Host Rescan
You can manually trigger a rescan of SCSI hosts by echoing the - - -
string to the scan
file for each host. This method is useful when you know the host number(s).
-
List SCSI hosts:
ls /sys/class/scsi_host/
-
Rescan each SCSI host:
for host in /sys/class/scsi_host/host*; do echo "- - -" | sudo tee $host/scan done
sg_scan
3. The sg_scan
command, also part of the sg3_utils
package, scans for and lists SCSI devices.
- Scan for SCSI devices:
sudo sg_scan -i
lsscsi
4. The lsscsi
command provides a detailed list of SCSI devices.
-
Install the lsscsi package:
sudo yum install lsscsi # For RHEL/CentOS sudo apt-get install lsscsi # For Debian/Ubuntu
-
List SCSI devices:
sudo lsscsi
multipath
(for environments using multipath)
5. If you are using device-mapper multipathing, you might need to refresh the multipath configuration.
- Reload multipath configuration:
sudo multipath -r
Example of Full Procedure
Here is a complete example procedure to scan for new FC storage devices on a Linux system:
-
Install necessary packages:
sudo yum install sg3_utils lsscsi device-mapper-multipath # For RHEL/CentOS sudo apt-get install sg3-utils lsscsi multipath-tools # For Debian/Ubuntu
-
Run the rescan-scsi-bus.sh script:
sudo rescan-scsi-bus.sh
-
Check for new devices with lsscsi:
sudo lsscsi
-
If using multipath, reload multipath configuration:
sudo multipath -r
By following these steps, you can effectively scan for and recognize new FC storage devices on your Linux system.