Skip to main content

NB: Linux Multipathing And (SAN) Disks

Some Linux shit stuff to do basic ops with FC.

T.B.D. a lot ;)

Change scheduler and some params:

lsscsi | grep OPEN-V | awk '{print "echo noop > /sys/block/"substr($6,6,length($6))"/queue/scheduler"}' | sh -x
lsscsi | grep OPEN-V | awk '{print "echo 2 > /sys/block/"substr($6,6,length($6))"/queue/rq_affinity"}' | sh -x
lsscsi | grep OPEN-V | awk '{print "echo 32 > /sys/block/"substr($6,6,length($6))"/queue/nr_requests"}' | sh -x

Remove all but one path in mpio config from exact disk:

multipath -ll /dev/disk/by-id/dm-name-360060e80164e000000014e0000000005 | grep ready | head -7 | awk  '{print "echo offline > /sys/block/"{"/device/state"}' | sh -x

Offline and disconnect disks frome host:

lsscsi | egrep 'NETAPP' | awk '{print "echo offline > /sys/block/"substr($7,6,length($7))"/device/state"}' | sh -x
lsscsi | egrep 'NETAPP' | awk '{print "echo 1 > /sys/block/"substr($7,6,length($7))"/device/delete"}' | sh -x

lsscsi | egrep 'OPEN-V' | awk '{print "echo offline > /sys/block/"substr($6,6,length($6))"/device/state"}' | sh -x
lsscsi | egrep 'OPEN-V' | awk '{print "echo 1 > /sys/block/"substr($6,6,length($6))"/device/delete"}' | sh -x
Pay attention ($7 and $6):
NETAPP = LUN C-Mode
HITACHI = OPEN-V

Changing some params:

lsscsi | grep OPEN-V | awk '{print "echo noop > /sys/block/"substr($6,6,length($6))"/queue/scheduler"}' | sh -x
lsscsi | grep OPEN-V | awk '{print "echo 2 > /sys/block/"substr($6,6,length($6))"/queue/rq_affinity"}' | sh -x
lsscsi | grep OPEN-V | awk '{print "echo 32 > /sys/block/"substr($6,6,length($6))"/queue/nr_requests"}' | sh -x

Defaults:

: scheduler = deadline
: add_random = 0
: rq_affinity = 1
: nr_requests = 128 

Identifing HBA:

cat /sys/class/fc_host/host14/port_name

Forcelip:

echo 1 > /sys/class/fc_host/host14/issue_lip