cmdref.net - Cheat Sheet and Example

cmdref.net is command references/cheat sheets/examples for system engineers.

User Tools

Site Tools


Sidebar








Etc


Reference














.

os:linux:disk:scan.html



Linux#Disk

Scanning Storage - How to scan storages in Linux

Check Disks

Operation Commands
To see what Fibre Channel devices are connected to the Fibre Channel HBA cards systool -c fc_remote_ports -v –d
For Fibre Channel transport information systool -c fc_transport –v
For information on SCSI disks connected to a system systool -c scsi_disk -v
To examine more disk information including which hosts are connected to which disks systool -b scsi –v
Use the sg_map command to view more information about the SCSI map sg_map –x
ls -l /dev/disk/by-id/


Rescanning Storage

The following commands can be used to scan storage interconnects.

HPE Proliant Server

# cd /opt/hp/hp_fibreutils
# ./hp_rescan -a

You must install fibreutils-x.x-x.x86_64.rpm
You can download SPP of SDR like below.
/spp/RedHat/6/x86_64/2013.09.0_supspp_rhel6.5_x86_64/fibreutils-3.2-6.x86_64.rpm

Linux

This operation performs a Loop Initialization Protocol (LIP) and then scans the interconnect and causes the SCSI layer to be updated to reflect the devices currently on the bus. A LIP is, essentially, a bus reset, and will cause device addition and removal.

echo "1" > /sys/class/fc_host/hostN/issue_lip
echo "1" > /sys/class/fc_host/host0/issue_lip
echo "1" > /sys/class/fc_host/host1/issue_lip

Linux

By default, this script scans all the SCSI buses on the system, updating the SCSI layer to reflect new devices on the bus. The script provides additional options to allow device removal and the issuing of LIPs.

/usr/bin/rescan-scsi-bus.sh

Linux

In this case, however, the channel number, SCSI target ID, and LUN values are replaced by wildcards. Any combination of identifiers and wildcards is allowed, allowing you to make the command as specific or broad as needed. This procedure will add LUNs, but not remove them.

echo "- - -" > /sys/class/scsi_host/hostN/scan
echo "- - -" > /sys/class/scsi_host/host0/scan
echo "- - -" > /sys/class/scsi_host/host1/scan
echo "- - -" > /sys/class/scsi_host/host3/scan

Linux

These commands completely re-initialize the state of all interconnects controlled by the driver.

rmmod driver-name      <- remove a module from the Linux Kernel
modprobe driver-name   <- add modules from the Linux Kernel


Check LUN Number

# dmsetup ls --target=multipath
mpath2  (253, 1)     <- LUN1
mpath1  (253, 0)     <- LUN0
mpath3  (253, 2)     <- LUN2
#

Consultation




os/linux/disk/scan.html.txt · Last modified: 2017/05/14 by admin

Page Tools