Re: SCSI host/channel/lun/part to /dev/sd* or maj/minor mapping

Douglas Gilbert (dougg@torque.net)
Fri, 14 Jun 2002 00:16:09 -0400


Mark Atwood write:
> Is there a mapping between the Host,Channel,Id,Lun of a SCSI device as
> reported in /proc/scsi/scsi, and the the /dev/sd* names and/or the
> major/minor device numbers?
>
> I've done some experamentation, and the more obvious ways of doing
> the mapping dont seem to be 100%.

Mark,
There are several utilities discussed at this url:
http://www.torque.net/sg/u_index.html
including scsidev and sg_map. Devfs shows you this mapping
via its hierarchy:
$ ls -l
total 0
brw------- 1 root root 8, 0 Dec 31 1969 disc
crw-r----- 1 root root 21, 0 Dec 31 1969 generic
brw------- 1 root root 8, 1 Dec 31 1969 part1
$ pwd
/dev/scsi/host1/bus0/target0/lun0/

None of these approaches is completely satisfactory. Kurt Garloff
is working on a patch that seems to address this problem quite
cleanly:

$ cat /proc/scsi/map
# C,B,T,U Type onl sg_nm sg_dev nm dev
0,0,00,00 05 1 sg0 c:15:00 sr0 b:0b:00
1,0,01,00 05 1 sg1 c:15:01 sr1 b:0b:01
1,0,03,00 05 1 sg3 c:15:03 sr2 b:0b:02
1,0,05,00 00 1 sg4 c:15:04 sda b:08:00
1,0,09,00 00 1 sg5 c:15:05 sdb b:08:10
1,0,02,00 01 1 sg2 c:15:02 osst0 c:ce:00
2,0,01,00 05 1 sg6 c:15:06 sr3 b:0b:03
2,0,02,00 01 1 sg7 c:15:07 osst1 c:ce:01
2,0,03,00 05 1 sg8 c:15:08 sr4 b:0b:04
2,0,09,00 00 1 sg10 c:15:0a sdd b:08:30
3,0,10,00 00 1 sg11 c:15:0b sde b:08:40
3,0,12,00 00 1 sg12 c:15:0c sdf b:08:50

Doug Gilbert
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/