determine drive's SAS port

Ian Lepore ian at FreeBSD.org
Sun Oct 20 17:01:47 UTC 2013


On Sat, 2013-10-19 at 18:15 +0400, Alexey Egorov wrote:
> Hello all,
> 
> I have a server with LSI HBA card, and when I remove drive I can see following messages in log:
> 
> (da0:mps0:0:5:0): lost device - 0 outstanding, 2 refs
> (da0:mps0:0:5:0): removing device entry
> 
> Is there a way to determine physical port (number "5" in "(da0:mps0:0:5:0)") when drive is inserted? (I need this to be able to create device symlinks based on physical port).
> 
> Thanks in advance. 

I don't have hardware like that to play with, but when I plug in an
eSata drive I get devd events like this:

root at dpnand:/root # cat /var/run/devd.pipe 
!system=DEVFS subsystem=CDEV type=CREATE cdev=pass2
!system=DEVFS subsystem=CDEV type=CREATE cdev=ada0
!system=DEVFS subsystem=CDEV type=CREATE cdev=ad0
!system=DEVFS subsystem=CDEV type=CREATE cdev=ada0p11
!system=DEVFS subsystem=CDEV type=CREATE cdev=ad0p11
!system=DEVFS subsystem=CDEV type=CREATE cdev=diskid/DISK-10MS109LT74Z
!system=DEVFS subsystem=CDEV type=CREATE cdev=ufsid/51fabc51ea1a923b
!system=DEVFS subsystem=CDEV type=CREATE cdev=gptid/c057d696-fae3-11e2-b79c-5404a6f2f88a
!system=DEVFS subsystem=CDEV type=CREATE cdev=diskid/DISK-10MS109LT74Zp11
^C

The pass2 dev appears in a camcontrol devlist, like this:

root at dpnand:/root # camcontrol devlist
<KINGSTON SNVP325S2256GB AGYA0202>  at scbus0 target 0 lun 0 (pass2,ada0)
<Generic STORAGE DEVICE 9910>      at scbus2 target 0 lun 0 (pass0,da0)
<Generic STORAGE DEVICE 9910>      at scbus2 target 0 lun 1 (pass1,da1)

Would the camcontrol bus/target/lun output give you the number you're
looking for?  It's a pity there isn't a devd event with more info in it
(similar to what you get when usb devices come and go), but perhaps with
some scripting you can make the connection between events and devices.

-- Ian






More information about the freebsd-hackers mailing list