How to find which disk a LUN is mapped to

Bryn M. Reeves bmr at redhat.com
Thu Apr 30 10:34:28 UTC 2009


On Thu, 2009-04-30 at 11:21 +0100, Bryn M. Reeves wrote:
> On Thu, 2009-04-30 at 10:16 +0100, Bryn M. Reeves wrote:
> > On Thu, 2009-04-30 at 13:25 +1200, Paul Ward wrote:
> > > Hi all,
> > > 
> > > I need to find out which disk LUN6 points to on my RH3 box.
> 
> Hmm. I just noticed that version. If you mean RHEL3 rather than Fedora
> Core 3 then you're unfortunately out of luck. The 2.4 kernel in RHEL3
> doesn't have sysfs. You can still match this up but you might find it
> easier to just look in dmesg - when the SCSI devices are registered (at
> boot or when they are added to the system) you should see the device
> name as well as the bus address logged.

You can also install the sg3_utils package (should be available on RHEL3
iirc) which can query the mappings and print them in a pretty format.

E.g.:

# sg_map -x
/dev/sg0  0 0 0 0  0  /dev/sda
/dev/sg1  0 0 1 0  0  /dev/sdb
/dev/sg2  3 0 0 0  0  /dev/sdc
/dev/sg3  3 0 0 1  0  /dev/sdd
[...]

# sginfo -l
/dev/scd0 /dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf /dev/sdg /dev/sdh /dev/sdi /dev/sdj /dev/sdk /dev/sdl /dev/sdm /dev/sdn /dev/sdo /dev/sdp /dev/sdq /dev/sdr /dev/sds /dev/sdt /dev/sdu /dev/sdv /dev/sdw /dev/sdx /dev/sdy /dev/sdz /dev/sdaa /dev/sdab /dev/sdac /dev/sdad /dev/sdae /dev/sdaf /dev/sdag /dev/sdah /dev/sdai /dev/sdak /dev/sdal /dev/sdam /dev/sdan /dev/sdao /dev/sdap /dev/sdaq /dev/sdar /dev/sdas /dev/sdat /dev/sdau /dev/sdaj 
/dev/sg0 [=/dev/sda  scsi0 ch=0 id=0 lun=0]
/dev/sg1 [=/dev/sdb  scsi0 ch=0 id=1 lun=0]
/dev/sg2 [=/dev/sdc  scsi3 ch=0 id=0 lun=0]
/dev/sg3 [=/dev/sdd  scsi3 ch=0 id=0 lun=1]
[...]

The sg_map command needs the sg module loaded to work.

Regards,
Bryn.





More information about the users mailing list