bash script

Grep DM disk:

lsblk | grep -B3 dm-126

List status of multipaths (-k is interactive mode for multipath daemon, you can run help to find more commands)

echo "list paths" | multipathd -k

List topology of multipaths:

echo "list topology" | multipathd -k

Detailed info about mpaths:

multipath -ll -v2

Nagios plugin check for multipath issues (only if nagios plugin is installed)

/usr/lib/nagios/plugins/check_multipath.pl -L

Note: The sg3_utils package provides the sg_turs command. The below command will short circuit any delay in getting and reporting the status by sending a scsi TEST UNIT READY command to each sdX device within the current configuration. The above causes an io to each device to give it the opportunity to report back the status rather than waiting and seeing them dribble back into the host over time.

ls -1c /dev/sd*[!0-9] | sort | xargs -I {} sg_turs -vv {}

List luns:

cat /proc/scsi/scsi
lsscsi --device
lsscsi --classic
lsscsi --list

Show targets

iscsiadm -m discovery

Show sessions

iscsiadm -m session

Show established targets

netstat -tpan | grep iscsid

Detailed luns information on all targets (will list luns on targets)

iscsiadm -m session  -P 3
iscsiadm -m session  -P 3 | grep -E "Current Portal|scsi.* Channel"

Rescan ALL sessions (each SAN target IP has its own session)

iscsiadm -m session --rescan

Rescan using the SCSI rescan script

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

Remove multipath device (this is handy if it was deleted on SAN like NetApp and no longer exist, but OS still picking up)

multipath -f 3600a098038313542412b514466546555