Views:

Summary



The following Linux commands show how block devices on the system map to storage system WWID’s. The information can be used to efficiently clean up unnecessary LUNs present on a client.

Symptoms



After performing ECX testing, LUNs may be created that are persistent from a supported iSCSI storage system. This article shows how to effectively determine what needs to be cleaned to remove these entities.

 


Resolution



The following procedure should outline the “map” to exactly identify iSCSI LUNs for cleanup purposes on Linux.

The first command, ‘lsblk’, will list out all of the block devices on the OS. In this case, I have identified an LVM device multi-pathed together under two separate block devices that I would like to clean named vg_oracle_u011472483067-lv_oracle_u01. Using whatever is the preferred mechanism, the starting point here is an identification of what block devices one is interested in inspecting or cleaning from the client system. In this case, the devices of interest are /dev/sde and /dev/sdi

[root@eh-centos-prod36 Desktop]# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

sr0 11:0 1 1024M 0 rom

sda 8:0 0 32G 0 disk

-sda1 8:1 0 500M 0 part /boot

-sda2 8:2 0 31.5G 0 part

-vg_ehcentosprod3-LogVol01 (dm-0)

253:0 0 3G 0 lvm [SWAP]

-vg_ehcentosprod3-LogVol00 (dm-1)

253:1 0 25.4G 0 lvm /

sdc 8:32 0 50G 0 disk

-mpath0 (dm-2) 253:2 0 50G 0 mpath

sdb 8:16 0 50G 0 disk

-mpath0 (dm-2) 253:2 0 50G 0 mpath

sdd 8:48 0 10G 0 disk

-mpath1 (dm-3) 253:3 0 10G 0 mpath

sde 8:64 0 50G 0 disk

-mpathb (dm-4) 253:4 0 50G 0 mpath

-vg_oracle_u011472483067-lv_oracle_u01 (dm-9)

253:9 0 45G 0 lvm

sdg 8:96 0 50G 0 disk

-mpathc (dm-6) 253:6 0 50G 0 mpath

-vg_oracle_u01-lv_oracle_u01 (dm-7)

253:7 0 45G 0 lvm /u01

sdh 8:112 0 10G 0 disk

-mpathe (dm-5) 253:5 0 10G 0 mpath

-vg_oracle_u02-lv_oracle_u02 (dm-8)

253:8 0 9G 0 lvm /u02

sdf 8:80 0 10G 0 disk

-mpath1 (dm-3) 253:3 0 10G 0 mpath

sdj 8:144 0 50G 0 disk

-mpathc (dm-6) 253:6 0 50G 0 mpath

-vg_oracle_u01-lv_oracle_u01 (dm-7)

253:7 0 45G 0 lvm /u01

sdi 8:128 0 50G 0 disk

-mpathb (dm-4) 253:4 0 50G 0 mpath

-vg_oracle_u011472483067-lv_oracle_u01 (dm-9)

253:9 0 45G 0 lvm

sdk 8:160 0 10G 0 disk

-mpathe (dm-5) 253:5 0 10G 0 mpath

-vg_oracle_u02-lv_oracle_u02 (dm-8)

253:8 0 9G 0 lvm /u02

 

Using this output, you can determine the iSCSI session number that corresponds to the block device. In the output below, there are two active sessions: session2 and session4 to the block device.

[root@eh-centos-prod36 Desktop]# ls -l /sys/block/sd*

lrwxrwxrwx 1 root root 0 Aug 31 11:57 /sys/block/sda -> ../devices/pci0000:00/0000:00:10.0/host2/target2:0:0/2:0:0:0/block/sda

lrwxrwxrwx 1 root root 0 Aug 31 11:57 /sys/block/sdb -> ../devices/platform/host4/session2/target4:0:0/4:0:0:0/block/sdb

lrwxrwxrwx 1 root root 0 Aug 31 11:57 /sys/block/sdc -> ../devices/platform/host4/session2/target4:0:0/4:0:0:1/block/sdc

lrwxrwxrwx 1 root root 0 Aug 31 11:57 /sys/block/sdd -> ../devices/platform/host4/session2/target4:0:0/4:0:0:3/block/sdd

lrwxrwxrwx 1 root root 0 Aug 31 11:57 /sys/block/sde -> ../devices/platform/host4/session2/target4:0:0/4:0:0:5/block/sde

lrwxrwxrwx 1 root root 0 Aug 31 11:57 /sys/block/sdf -> ../devices/platform/host6/session4/target6:0:0/6:0:0:0/block/sdf

lrwxrwxrwx 1 root root 0 Aug 31 11:57 /sys/block/sdg -> ../devices/platform/host6/session4/target6:0:0/6:0:0:1/block/sdg

lrwxrwxrwx 1 root root 0 Aug 31 11:57 /sys/block/sdh -> ../devices/platform/host6/session4/target6:0:0/6:0:0:3/block/sdh

lrwxrwxrwx 1 root root 0 Aug 31 11:57 /sys/block/sdi -> ../devices/platform/host6/session4/target6:0:0/6:0:0:5/block/sdi

 

To determine the map of what storage corresponds to each session, issue the ‘iscsiadm –m session’ command, as follows. You can to determine the storage system from its discovery IQN.

[root@eh-centos-prod36 Desktop]# iscsiadm -m session

tcp: [1] OSS-Master.qa.catalogic.us:3260,1 iqn.2003-06.com.syncsort:oss-master.qa.catalogic.us.bexdevice.bexdevice0 (non-flash)

tcp: [2] 172.20.240.44:3260,1 iqn.1986-03.com.ibm:2145.balrog.devad.catalogic.us.node2 (non-flash)

tcp: [3] 172.20.240.33:3260,1 iqn.1986-03.com.ibm:2145.grendel.devad.catalogic.us.node1 (non-flash)

tcp: [4] 172.20.240.43:3260,1 iqn.1986-03.com.ibm:2145.balrog.devad.catalogic.us.node1 (non-flash)

 

The WWID of the block device can be determined either from ‘multipath –ll’ if multipathing is involved or from the “scsi_id –g –u <device>” command. For example:

[root@eh-centos-prod36 Desktop]# scsi_id -g -u /dev/sdi

3600507680283084568000000000086a4

 

Summarily, the above commands show how one can locate the storage system by comparing the iSCSI session data with a long list of the block devices and the WWID from the “scsi_id” command on the block device.

.