Applies to:
- RHEL v5 or newer
- Any other linux distro, I guess?
You can get the LUN ID info for certain LUN, by either performing several commands.
If you have multipath enabled, do:
[root@steelheart ~]# multipath -ll
The output should look like this:
mpath1 (200173800107503ed) dm-5 IBM,2450XIV [size=480G][features=1 queue_if_no_path][hwhandler=0][rw] \_ round-robin 0 [prio=12][active] \_ 5:0:3:2 sdaa 65:208 [active][ready] \_ 5:0:4:2 sdab 66:96 [active][ready] \_ 5:0:5:2 sdac 66:240 [active][ready] \_ 7:0:0:2 sdba 67:128 [active][ready] \_ 7:0:1:2 sdbb 68:16 [active][ready] \_ 7:0:2:2 sdbc 68:160 [active][ready] \_ 7:0:3:2 sdca 69:48 [active][ready] \_ 7:0:4:2 sdcb 69:192 [active][ready] \_ 7:0:5:2 sdcc 70:80 [active][ready] \_ 5:0:0:2 sdda 8:32 [active][ready] \_ 5:0:1:2 sddb 8:176 [active][ready] \_ 5:0:2:2 sddc 65:64 [active][ready]
The 4th digit is your LUN ID. In this case the LUN ID is “2”
If the server doesn’t use multipath, you can get the info by:
[root@steelheart ~]# ls -l /sys/block/*/device
This is the output, please scroll to the far right:
lrwxrwxrwx 1 root root 0 Jul 18 10:13 /sys/block/sdaa/device -> ../../devices/pci0000:00/0000:00:07.0/0000:1f:00.0/host5/rport-5:0-2/target5:0:2/5:0:2:14 lrwxrwxrwx 1 root root 0 Jul 18 10:13 /sys/block/sdab/device -> ../../devices/pci0000:00/0000:00:07.0/0000:1f:00.0/host5/rport-5:0-3/target5:0:3/5:0:3:14 lrwxrwxrwx 1 root root 0 Jul 18 10:13 /sys/block/sdac/device -> ../../devices/pci0000:00/0000:00:07.0/0000:1f:00.0/host5/rport-5:0-4/target5:0:4/5:0:4:14 lrwxrwxrwx 1 root root 0 Jul 18 10:13 /sys/block/sdba/device -> ../../devices/pci0000:00/0000:00:07.0/0000:1f:00.0/host5/rport-5:0-5/target5:0:5/5:0:5:14 lrwxrwxrwx 1 root root 0 Jul 18 10:13 /sys/block/sdbb/device -> ../../devices/pci0000:00/0000:00:09.0/0000:24:00.0/host7/rport-7:0-0/target7:0:0/7:0:0:14 lrwxrwxrwx 1 root root 0 Jul 18 10:13 /sys/block/sdbc/device -> ../../devices/pci0000:00/0000:00:09.0/0000:24:00.0/host7/rport-7:0-1/target7:0:1/7:0:1:14
In this case, the LUN ID for these disks are “14”
So, there you go 🙂
[…] https://outhereinthefield.wordpress.com/2014/08/13/identifying-lun-id-on-redhat-enterprise-linux/ […]