Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Oct 2013 10:34:59 -0600
From:      Ian Lepore <ian@FreeBSD.org>
To:        Alexey Egorov <electreg@list.ru>
Cc:        freebsd-hackers@FreeBSD.org
Subject:   Re: determine drive's SAS port
Message-ID:  <1382286899.92499.110.camel@revolution.hippie.lan>
In-Reply-To: <1382192148.119437035@f257.i.mail.ru>
References:  <1382192148.119437035@f257.i.mail.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 2013-10-19 at 18:15 +0400, Alexey Egorov wrote:
> Hello all,
>=20
> I have a server with LSI HBA card, and when I remove drive I can see fo=
llowing messages in log:
>=20
> (da0:mps0:0:5:0): lost device - 0 outstanding, 2 refs
> (da0:mps0:0:5:0): removing device entry
>=20
> Is there a way to determine physical port (number "5" in "(da0:mps0:0:5=
:0)=EF=BB=BF=EF=BB=BF") when drive is inserted? (I need this to be able t=
o create device symlinks based on physical port).
>=20
> Thanks in advance.=20

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@dpnand:/root # cat /var/run/devd.pipe=20
!system=3DDEVFS subsystem=3DCDEV type=3DCREATE cdev=3Dpass2
!system=3DDEVFS subsystem=3DCDEV type=3DCREATE cdev=3Dada0
!system=3DDEVFS subsystem=3DCDEV type=3DCREATE cdev=3Dad0
!system=3DDEVFS subsystem=3DCDEV type=3DCREATE cdev=3Dada0p11
!system=3DDEVFS subsystem=3DCDEV type=3DCREATE cdev=3Dad0p11
!system=3DDEVFS subsystem=3DCDEV type=3DCREATE cdev=3Ddiskid/DISK-10MS109=
LT74Z
!system=3DDEVFS subsystem=3DCDEV type=3DCREATE cdev=3Dufsid/51fabc51ea1a9=
23b
!system=3DDEVFS subsystem=3DCDEV type=3DCREATE cdev=3Dgptid/c057d696-fae3=
-11e2-b79c-5404a6f2f88a
!system=3DDEVFS subsystem=3DCDEV type=3DCREATE cdev=3Ddiskid/DISK-10MS109=
LT74Zp11
^C

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

root@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







Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1382286899.92499.110.camel>