[CentOS] Mounting LUNs from a SAN array - LUN mappings to devices in /dev/ - are they static?

Sat Oct 4 16:22:39 UTC 2014
Rafał Radecki <radecki.rafal at gmail.com>

Hi All :)

I am currently involved in a project in which there is a SAN array (Sun
Storagetek 2540) which exports LUNs for some servers with Centos 5.2 x86. I
will be performing a migration to Centos 5.9 x86_64 in some time and am
gathering needed info now :)

I am trying to find the place in the OS where there is the information
about LUN mappings to /dev/ devices.

For example on array level I have an exported LUN with number 8. I see it
on one of the servers with lsscsi as:

# lsscsi  | grep '7\:0\:0\:8'
[7:0:0:8]    disk    SUN      LCSM100_F        0735  /dev/sdj

As I said I need to perform migration of the OS to Centos 5.9 x86_64 and am
curious where from does the mapping

scsi device 7:0:0:8 <-> /dev/sdj

come?

I have some complex logical volume (Veritas Volume Manager) setup based on
/dev/ disks (which are derived from  LUNs imported from the array) and will
need to recreate it on destination servers. My coworker said that udev may
be assigning the /dev/sdj (and other) identifier so I checked this. In
/etc/udev/rules.d/* I see rules for scsi subsystem (sysfs type 0 is "disk"):

ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt"
ACTION=="add", SUBSYSTEM=="scsi_device", SYSFS{type}=="0",
RUN+="socket:/org/kernel/diskres/uevents"
ACTION=="remove", SUBSYSTEM=="scsi_device",
RUN+="socket:/org/kernel/diskres/uevents"

So I do not see anything which could answer my question. There have been
other rules for different sysfs types but I think they are not relevant in
my case.

In sysfs in /sys/bus/scsi/devices/7:0:0:8 I found:

# ll block\:sdj
lrwxrwxrwx 1 root root 0 Oct  4 17:57 block:sdj ->
../../../../../../../../../../block/sdj

Where else can I look for the LUN<->/dev/ device mapping rules? How are the
LUNs mapped to operating system devices? Is there a way to add a static
mapping so that also on a new server after attaching SAN array LUN number 8
will be visible as /dev/sdj? I think that there is a possibility that on a
new server mentioned LUN will be visible as a different /dev/sd? :( That
could potentially break my logical volume setup on the destination server.

Any info will be greatly appreciated :)

BR,
Rafal.