Developers Guide

Volume management
7 Dell EMC SC Series with Red Hat Enterprise Linux 7x | CML1071
2 Volume management
Understanding how volumes are managed in Linux requires basic understanding of the /sys pseudo
filesystem. The /sys filesystem is a structure of files that allow interaction with various elements of the kernel
and modules. While the read-only files store current values, read/write files trigger events with the correct
commands. Generally, the cat and echo commands are used with a redirect as STDIN instead of being
opened with a traditional text editor.
To interact with the HBAs (FC, iSCSI, and SAS), commands are issued against special files located in the
/sys/class/scsi_host/ folder. Each port on a multiport card represents a unique HBA, and each HBA has its
own hostX folder containing files for issuing scans and reading HBA parameters. The folder layout, files, and
functionality can vary depending on the HBA vendor or type (for example, QLogic
®
Fibre Channel, Emulex
®
Fibre Channel, software-iSCSI based HBAs, or Dell EMC 12Gbps SAS HBAs).
2.1 Scanning for new volumes
The driver modules required for the QLogic 24xx/25xx Series HBAs and the Emulex HBAs are merged into
base kernel code. The following instructions apply to the default HBA driver modules. If the vendor (QLogic,
Emulex) proprietary driver has been used, consult the vendor-specific documentation for instructions and
further details.
This script identifies the major revision number of the Linux operating system and applies the echo command
to the respective hostX devices within the /sys/class/scsi_host/ folder. This script scans the HBA ports, and
discovers and identifies existing and new volumes presented to the host from the storage array. This script
can be used to discover both FC and iSCSI devices presented to the host and it applies for RHEL versions
5.x7.x.
Note: STDOUT is not generated from this script. Check the contents of /var/log/messages or the output from
the dmesg or lsscsi commands to identify any newly discovered volumes.
Rescanning the HBAs while mapping and discovering new volumes does not have any negative impact on
the host.
#!/bin/bash
OSMajor=`uname -r | awk -F. '{print $(NF-1)}'`
echo "INFO: OS Major rev. ${OSMajor} detected!"
if [ "${OSMajor}" = "el7" -o "${OSMajor}" = "el6" ]; then
for i in /sys/class/scsi_host/*
do
echo "- - -" >> ${i}/scan
done
elif [ "$(uname -r | awk -F. '{print $(NF)}')" = "el5" ]; then
echo "INFO: OS Major rev. el5 detected instead!"
for i in /sys/class/scsi_host/*
do
echo 1 >> ${i}/issue_lip
echo "- - -" >> ${i}/scan
done