[Gllug] SCSI device ID to ACTL mapping?

Mike Brodbelt mike at coruscant.demon.co.uk
Wed Feb 2 00:36:11 UTC 2005


On Tue, 2005-02-01 at 23:01 +0000, Ian Northeast wrote:
> I'm just starting to use multipathed SAN storage with Linux and this 
> means that the sd? name to Adapter,channel,target,LUN mapping keeps 
> changing. Whenever a new disk is zoned in its path on adapter 0 is 
> detected before all the paths on adapter 1 so all the latter get moved 
> down. What used to be sdg now becomes sdi for instance. The LVM takes 
> care of it if you get it right, so it's just somewhat inconvenient ATM 
> but I can see it causing major havoc when I have to transfer 
> administration to India. Which I will have to, sometime, it's not optional:(
> 
> I'll be looking at using "scsidev" to assign permanant names to SCSI 
> devices, but one thing which would be really useful would be a reliable 
> way to map sd? names to A/C/T/Ls. I assumed that this would be easy 
> enough, the kernel must know after all or the devices wouldn't work. But 
> I can't find any easy way to get it to tell me "sdb is scsi0, channel 0, 
> target 1, LUN 1" or such like, except in the messages the driver issues 
> as it's loaded, which can't be relied upon to be available. Nothing in 
> /proc seems to contain this information. Does anyone know how to find this?

Sysfs in 2.6 will do it for you:-

$ ls -l /sys/bus/scsi/devices/
total 0
lrwxrwxrwx  1 root root 0 2005-02-01 19:29 0:0:0:0 -> ../../../devices/pci0000:00/0000:00:0e.0/host0/0:0:0:0
lrwxrwxrwx  1 root root 0 2005-02-01 19:29 0:0:1:0 -> ../../../devices/pci0000:00/0000:00:0e.0/host0/0:0:1:0
lrwxrwxrwx  1 root root 0 2005-02-01 19:29 0:0:2:0 -> ../../../devices/pci0000:00/0000:00:0e.0/host0/0:0:2:0
lrwxrwxrwx  1 root root 0 2005-02-01 19:29 0:0:3:0 -> ../../../devices/pci0000:00/0000:00:0e.0/host0/0:0:3:0
lrwxrwxrwx  1 root root 0 2005-02-01 19:29 1:0:5:0 -> ../../../devices/pci0000:00/0000:00:10.0/host1/1:0:5:0
lrwxrwxrwx  1 root root 0 2005-02-01 19:29 1:0:5:1 -> ../../../devices/pci0000:00/0000:00:10.0/host1/1:0:5:1
lrwxrwxrwx  1 root root 0 2005-02-01 19:31 2:0:0:0 -> ../../../devices/pci0000:00/0000:00:07.2/usb1/1-1/1-1.4/1-1.4:1.0/host2/2:0:0:0
lrwxrwxrwx  1 root root 0 2005-02-01 19:31 3:0:0:0 -> ../../../devices/pci0000:00/0000:00:07.2/usb1/1-1/1-1.3/1-1.3:1.0/host3/3:0:0:0
lrwxrwxrwx  1 root root 0 2005-02-01 19:31 4:0:0:0 -> ../../../devices/pci0000:00/0000:00:12.0/fw-host0/00d0b8704b00006c/00d0b8704b00006c-0/host4/4:0:0:0
lrwxrwxrwx  1 root root 0 2005-02-01 19:55 5:0:0:0 -> ../../../devices/pci0000:00/0000:00:12.0/fw-host0/00d04b4b010842c6/00d04b4b010842c6-0/host5/5:0:0:0


$ ls -l /sys/bus/scsi/devices/0\:0\:0\:0/block/
total 0
-r--r--r--  1 root root 4096 2005-02-01 19:29 dev
lrwxrwxrwx  1 root root    0 2005-02-01 19:29 device -> ../../devices/pci0000:00/0000:00:0e.0/host0/0:0:0:0
drwxr-xr-x  3 root root    0 2005-02-01 19:29 queue
-r--r--r--  1 root root 4096 2005-02-01 19:29 range
-r--r--r--  1 root root 4096 2005-02-01 19:29 removable
drwxr-xr-x  2 root root    0 2005-02-01 19:29 sda1
drwxr-xr-x  2 root root    0 2005-02-01 19:29 sda10
drwxr-xr-x  2 root root    0 2005-02-01 19:29 sda2
drwxr-xr-x  2 root root    0 2005-02-01 19:29 sda3
drwxr-xr-x  2 root root    0 2005-02-01 19:29 sda5
drwxr-xr-x  2 root root    0 2005-02-01 19:29 sda6
drwxr-xr-x  2 root root    0 2005-02-01 19:29 sda7
drwxr-xr-x  2 root root    0 2005-02-01 19:29 sda8
drwxr-xr-x  2 root root    0 2005-02-01 19:29 sda9
-r--r--r--  1 root root 4096 2005-02-01 19:29 size
-r--r--r--  1 root root 4096 2005-02-01 19:29 stat

HTH,

Mike.


-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list