Saturday, 12 May 2018

Fiber Channel Cheat Sheet - Adding new LUNs

New Server that has no LUNs
[root@B54LFRTMPSTG01 ~]# hostname && cat /etc/redhat-release 
B54LFRTMPSTG01
Red Hat Enterprise Linux Server release 7.4 (Maipo)


Make sue that there is not Attached LUNs by cechking "/proc/scsi/scsi":
[root@B54LFRTMPSTG01 ~]# cat /proc/scsi/scsi 
Attached devices:


As you have only Direct Attached Disks, you will see them only under "/dev/disk/by-path":
[root@B54LFRTMPSTG01 ~]# ls -lha /dev/disk/by-path/
total 0
drwxr-xr-x 2 root root 100 Apr 28 11:29 .
drwxr-xr-x 5 root root 100 Apr 23 10:34 ..
lrwxrwxrwx 1 root root  16 Apr 23 10:35 pci-0000:0b:08.0-cciss-disk0 -> ../../cciss/c0d0
lrwxrwxrwx 1 root root  18 Apr 23 10:35 pci-0000:0b:08.0-cciss-disk0-part1 -> ../../cciss/c0d0p1
lrwxrwxrwx 1 root root  18 Apr 23 10:35 pci-0000:0b:08.0-cciss-disk0-part2 -> ../../cciss/c0d0p2


Check How many Fibre Channel Cards (HBAs), you have two: "host0" and "host1"
[root@B54LFRTMPSTG01 ~]# ls /sys/class/fc_host
host0  host1


Refresh LUNs list to discover new mapped LUNs to your OS:
[root@B54LFRTMPSTG01 ~]# echo "1" > /sys/class/fc_host/host0/issue_lip
[root@B54LFRTMPSTG01 ~]# echo "- - -" > /sys/class/scsi_host/host0/scan
[root@B54LFRTMPSTG01 ~]# echo "1" > /sys/class/fc_host/host1/issue_lip
[root@B54LFRTMPSTG01 ~]# echo "- - -" > /sys/class/scsi_host/host1/scan


Now, there are 20 LUNs attached to your OS:
Vendor: IBM
Model: 2145
[root@B54LFRTMPSTG01 ~]# cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 01 Lun: 00
  Vendor: IBM      Model: 2145             Rev: 0000
  Type:   Direct-Access                    ANSI  SCSI revision: 06
Host: scsi0 Channel: 00 Id: 01 Lun: 01
  Vendor: IBM      Model: 2145             Rev: 0000
  Type:   Direct-Access                    ANSI  SCSI revision: 06
Host: scsi0 Channel: 00 Id: 01 Lun: 02
  Vendor: IBM      Model: 2145             Rev: 0000
  Type:   Direct-Access                    ANSI  SCSI revision: 06
Host: scsi0 Channel: 00 Id: 01 Lun: 03
  Vendor: IBM      Model: 2145             Rev: 0000
  Type:   Direct-Access                    ANSI  SCSI revision: 06
Host: scsi0 Channel: 00 Id: 01 Lun: 04
  Vendor: IBM      Model: 2145             Rev: 0000
  Type:   Direct-Access                    ANSI  SCSI revision: 06
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: IBM      Model: 2145             Rev: 0000
  Type:   Direct-Access                    ANSI  SCSI revision: 06
Host: scsi0 Channel: 00 Id: 00 Lun: 01
  Vendor: IBM      Model: 2145             Rev: 0000
  Type:   Direct-Access                    ANSI  SCSI revision: 06
Host: scsi0 Channel: 00 Id: 00 Lun: 02
  Vendor: IBM      Model: 2145             Rev: 0000
  Type:   Direct-Access                    ANSI  SCSI revision: 06
Host: scsi0 Channel: 00 Id: 00 Lun: 03
  Vendor: IBM      Model: 2145             Rev: 0000
  Type:   Direct-Access                    ANSI  SCSI revision: 06
Host: scsi0 Channel: 00 Id: 00 Lun: 04
  Vendor: IBM      Model: 2145             Rev: 0000
  Type:   Direct-Access                    ANSI  SCSI revision: 06
Host: scsi1 Channel: 00 Id: 00 Lun: 00
  Vendor: IBM      Model: 2145             Rev: 0000
  Type:   Direct-Access                    ANSI  SCSI revision: 06
Host: scsi1 Channel: 00 Id: 00 Lun: 01
  Vendor: IBM      Model: 2145             Rev: 0000
  Type:   Direct-Access                    ANSI  SCSI revision: 06
Host: scsi1 Channel: 00 Id: 00 Lun: 02
  Vendor: IBM      Model: 2145             Rev: 0000
  Type:   Direct-Access                    ANSI  SCSI revision: 06
Host: scsi1 Channel: 00 Id: 00 Lun: 03
  Vendor: IBM      Model: 2145             Rev: 0000
  Type:   Direct-Access                    ANSI  SCSI revision: 06
Host: scsi1 Channel: 00 Id: 00 Lun: 04
  Vendor: IBM      Model: 2145             Rev: 0000
  Type:   Direct-Access                    ANSI  SCSI revision: 06
Host: scsi1 Channel: 00 Id: 01 Lun: 00
  Vendor: IBM      Model: 2145             Rev: 0000
  Type:   Direct-Access                    ANSI  SCSI revision: 06
Host: scsi1 Channel: 00 Id: 01 Lun: 01
  Vendor: IBM      Model: 2145             Rev: 0000
  Type:   Direct-Access                    ANSI  SCSI revision: 06
Host: scsi1 Channel: 00 Id: 01 Lun: 02
  Vendor: IBM      Model: 2145             Rev: 0000
  Type:   Direct-Access                    ANSI  SCSI revision: 06
Host: scsi1 Channel: 00 Id: 01 Lun: 03
  Vendor: IBM      Model: 2145             Rev: 0000
  Type:   Direct-Access                    ANSI  SCSI revision: 06
Host: scsi1 Channel: 00 Id: 01 Lun: 04
  Vendor: IBM      Model: 2145             Rev: 0000
  Type:   Direct-Access                    ANSI  SCSI revision: 06
[root@B54LFRTMPSTG01 ~]# cat /proc/scsi/scsi | egrep -i 'Host:' | wc -l
20
[root@B54LFRTMPSTG01 ~]# fdisk -l 2>/dev/null | egrep '^Disk' | egrep -v 'dm-|type|identifier'
Disk /dev/cciss/c0d0: 73.4 GB, 73372631040 bytes, 143305920 sectors
Disk /dev/mapper/rhel-root: 21.5 GB, 21474836480 bytes, 41943040 sectors
Disk /dev/mapper/rhel-swap: 7340 MB, 7340032000 bytes, 14336000 sectors
Disk /dev/sda: 536.9 GB, 536870912000 bytes, 1048576000 sectors
Disk /dev/sdb: 59.1 GB, 59055800320 bytes, 115343360 sectors
Disk /dev/sdc: 59.1 GB, 59055800320 bytes, 115343360 sectors
Disk /dev/sdd: 59.1 GB, 59055800320 bytes, 115343360 sectors
Disk /dev/sde: 1073.7 GB, 1073741824000 bytes, 2097152000 sectors
Disk /dev/sdf: 536.9 GB, 536870912000 bytes, 1048576000 sectors
Disk /dev/sdg: 59.1 GB, 59055800320 bytes, 115343360 sectors
Disk /dev/mapper/mpathc: 536.9 GB, 536870912000 bytes, 1048576000 sectors
Disk /dev/mapper/mpathd: 59.1 GB, 59055800320 bytes, 115343360 sectors
Disk /dev/sdh: 59.1 GB, 59055800320 bytes, 115343360 sectors
Disk /dev/sdi: 59.1 GB, 59055800320 bytes, 115343360 sectors
Disk /dev/mapper/mpathe: 59.1 GB, 59055800320 bytes, 115343360 sectors
Disk /dev/sdj: 1073.7 GB, 1073741824000 bytes, 2097152000 sectors
Disk /dev/mapper/mpathf: 59.1 GB, 59055800320 bytes, 115343360 sectors
Disk /dev/mapper/mpathg: 1073.7 GB, 1073741824000 bytes, 2097152000 sectors
Disk /dev/sdk: 536.9 GB, 536870912000 bytes, 1048576000 sectors
Disk /dev/sdl: 59.1 GB, 59055800320 bytes, 115343360 sectors
Disk /dev/sdm: 59.1 GB, 59055800320 bytes, 115343360 sectors
Disk /dev/sdn: 59.1 GB, 59055800320 bytes, 115343360 sectors
Disk /dev/sdo: 1073.7 GB, 1073741824000 bytes, 2097152000 sectors
Disk /dev/sdp: 536.9 GB, 536870912000 bytes, 1048576000 sectors
Disk /dev/sdq: 59.1 GB, 59055800320 bytes, 115343360 sectors
Disk /dev/sdr: 59.1 GB, 59055800320 bytes, 115343360 sectors
Disk /dev/sds: 59.1 GB, 59055800320 bytes, 115343360 sectors
Disk /dev/sdt: 1073.7 GB, 1073741824000 bytes, 2097152000 sectors


Optional: Find Device instructions to e added to "/etc/multipath.conf" configuration file:
RHEL 7
[root@B54LFRTMPSTG01 ~]# multipath -t | grep -B2 -A8 2145
 device {
  vendor "IBM"
  product "^2145"
  path_grouping_policy "group_by_prio"
  path_checker "tur"
  features "1 queue_if_no_path"
  hardware_handler "0"
  prio "alua"
  failback immediate
  rr_weight "uniform"
 }
RHEL 6
[root@fcsmpsql4:~]# grep -B2 -A12  2145 /usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf.defaults 
# device {
#  vendor "IBM"
#  product "^2145"
#  path_grouping_policy group_by_prio
#  getuid_callout "/lib/udev/scsi_id --whitelisted --device=/dev/%n"
#  path_selector "round-robin 0"
#  path_checker tur
#  features "1 queue_if_no_path"
#  hardware_handler "0"
#  prio alua
#  failback immediate
#  rr_weight uniform
#  rr_min_io 1000
#  rr_min_io_rq 1
# }


Set initial configuration for "multipathd" daemon using "mpathconf" command:
mpathconf --enable --user_friendly_names n'


Adjust the "multipath" configurations as you need, here is just an example:
[root@B54LFRTMPSTG01 ~]# grep -v ^# /etc/multipath.conf | awk NF
defaults {
 user_friendly_names yes
 find_multipaths yes
}
devices {
 device {
  vendor "IBM"
  product "^2145"
  path_grouping_policy "group_by_prio"
  path_checker "tur"
  features "1 queue_if_no_path"
  hardware_handler "0"
  prio "alua"
  failback immediate
  rr_weight "uniform"
 }
}
[root@B54LFRTMPSTG01 ~]# systemctl restart multipathd 


List the new 'multipath -ll' output:
[root@B54LFRTMPSTG01 ~]# multipath -ll
mpathe (3600507680c800507f0000000000000c6) dm-4 IBM     ,2145            
size=55G features='1 queue_if_no_path' hwhandler='0' wp=rw
|-+- policy='service-time 0' prio=50 status=active
| |- 0:0:0:2 sdh        8:112 active ready running
| `- 1:0:0:2 sdm        8:192 active ready running
`-+- policy='service-time 0' prio=10 status=enabled
  |- 0:0:1:2 sdc        8:32  active ready running
  `- 1:0:1:2 sdr        65:16 active ready running
mpathd (3600507680c800507f0000000000000c5) dm-3 IBM     ,2145            
size=55G features='1 queue_if_no_path' hwhandler='0' wp=rw
|-+- policy='service-time 0' prio=50 status=active
| |- 0:0:0:1 sdg        8:96  active ready running
| `- 1:0:0:1 sdl        8:176 active ready running
`-+- policy='service-time 0' prio=10 status=enabled
  |- 0:0:1:1 sdb        8:16  active ready running
  `- 1:0:1:1 sdq        65:0  active ready running
mpathc (3600507680c800507f0000000000000c4) dm-2 IBM     ,2145            
size=500G features='1 queue_if_no_path' hwhandler='0' wp=rw
|-+- policy='service-time 0' prio=50 status=active
| |- 0:0:0:0 sdf        8:80  active ready running
| `- 1:0:0:0 sdk        8:160 active ready running
`-+- policy='service-time 0' prio=10 status=enabled
  |- 0:0:1:0 sda        8:0   active ready running
  `- 1:0:1:0 sdp        8:240 active ready running
mpathg (3600507680c800507f0000000000000c8) dm-6 IBM     ,2145            
size=1000G features='1 queue_if_no_path' hwhandler='0' wp=rw
|-+- policy='service-time 0' prio=50 status=active
| |- 0:0:0:4 sdj        8:144 active ready running
| `- 1:0:0:4 sdo        8:224 active ready running
`-+- policy='service-time 0' prio=10 status=enabled
  |- 0:0:1:4 sde        8:64  active ready running
  `- 1:0:1:4 sdt        65:48 active ready running
mpathf (3600507680c800507f0000000000000c7) dm-5 IBM     ,2145            
size=55G features='1 queue_if_no_path' hwhandler='0' wp=rw
|-+- policy='service-time 0' prio=50 status=active
| |- 0:0:0:3 sdi        8:128 active ready running
| `- 1:0:0:3 sdn        8:208 active ready running
`-+- policy='service-time 0' prio=10 status=enabled
  |- 0:0:1:3 sdd        8:48  active ready running
  `- 1:0:1:3 sds        65:32 active ready running

No comments:

Post a Comment