From owner-freebsd-hackers@FreeBSD.ORG Sun Oct 20 17:01:47 2013 Return-Path: Delivered-To: freebsd-hackers@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 95764505 for ; Sun, 20 Oct 2013 17:01:47 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mho-02-ewr.mailhop.org (mho-02-ewr.mailhop.org [204.13.248.72]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5984822EA for ; Sun, 20 Oct 2013 17:01:47 +0000 (UTC) Received: from c-24-8-230-52.hsd1.co.comcast.net ([24.8.230.52] helo=damnhippie.dyndns.org) by mho-02-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1VXvy3-0005Mw-Ez; Sun, 20 Oct 2013 16:35:03 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id r9KGYxj1033049; Sun, 20 Oct 2013 10:34:59 -0600 (MDT) (envelope-from ian@FreeBSD.org) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 24.8.230.52 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX1+LZRVO8lMpeTBtaigiQHAA Subject: Re: determine drive's SAS port From: Ian Lepore To: Alexey Egorov In-Reply-To: <1382192148.119437035@f257.i.mail.ru> References: <1382192148.119437035@f257.i.mail.ru> Content-Type: text/plain; charset="UTF-8" Date: Sun, 20 Oct 2013 10:34:59 -0600 Message-ID: <1382286899.92499.110.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by damnhippie.dyndns.org id r9KGYxj1033049 Cc: freebsd-hackers@FreeBSD.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2013 17:01:47 -0000 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 at scbus0 target 0 lun 0 (pass2,ada0) at scbus2 target 0 lun 0 (pass0,da0) 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