Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Oct 2013 10:42:22 -0600
From:      Alan Somers <asomers@freebsd.org>
To:        Ian Lepore <ian@freebsd.org>
Cc:        Alexey Egorov <electreg@list.ru>, freebsd-hackers@freebsd.org
Subject:   Re: determine drive's SAS port
Message-ID:  <CAOtMX2gKFkbyeSoYUsdm7AnRXte-MORS7FhO=Y%2BK9SvVK4SU1g@mail.gmail.com>
In-Reply-To: <1382286899.92499.110.camel@revolution.hippie.lan>
References:  <1382192148.119437035@f257.i.mail.ru> <1382286899.92499.110.camel@revolution.hippie.lan>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Oct 20, 2013 at 10:34 AM, Ian Lepore <ian@freebsd.org> wrote:
> 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@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@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
>
>
>
>
> _______________________________________________
> freebsd-hackers@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"

If your disk is connected to a SAS expander, then you can use either
SES or SMP commands to figure out the port to which a drive is
connected.  But it sounds like your disks are connected directly to
the HBA?  If that's the case, the problem is much harder.  I don't
think that there is a standard way to get it, and the FreeBSD kernel
doesn't currently help much.  mps(4) accepts some custom ioctls to
look up configuration information.  To learn how to use them, ask your
LSI FAE for the "Fusion-MPT 2.0 Message Passing Interface (MPI)
Specification Guide".  The best solution would be to update the kernel
to report physical path information for da disks.  I think that
information is currently reported only for disks connected to a SES
enclosure.

-Alan



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOtMX2gKFkbyeSoYUsdm7AnRXte-MORS7FhO=Y%2BK9SvVK4SU1g>