[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: How to find which disk a LUN is mapped to

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.
> I have looked at /proc/scsi/scsi
> This gives me LUNS from 00 to 05
> Does this mean 05 is infact LUN06?

These days it's easiest to find this information from sysfs.

Under /sys/bus/scsi/devices you'll find sub-directories that list all
SCSI devices by their bus address (in host:bus:target:lun format). E.g.
if I want to find out what device 3:0:0:1 on my system is I can look at:

# ls /sys/bus/scsi/devices/3\:0\:0\:1/
block:sdd  delete          dh_state  generic        iodone_cnt
iorequest_cnt  power        queue_type  rev
scsi_disk:3:0:0:1  scsi_level  subsystem  type    vendor
bus        device_blocked  driver    iocounterbits  ioerr_cnt   model
queue_depth  rescan      scsi_device:3:0:0:1  scsi_generic:sg3   state
timeout    uevent

The first entry is a symlink that points back to the corresponding block
device, in this case /dev/sdd:

# ls -l /sys/bus/scsi/devices/3\:0\:0\:1/block\:sdd 
lrwxrwxrwx 1 root root 0 Apr 30
10:06 /sys/bus/scsi/devices/3:0:0:1/block:sdd
-> ../../../../../../../../../block/sdd

All the symlinks can make navigating sysfs a bit daunting at first but
there's a wealth of useful information and knobs to tweak in there.
Tools like systool and udevinfo can also help to make it a bit easier to


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]