From owner-freebsd-hackers@FreeBSD.ORG Mon Oct 21 16:42:24 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id CA3CB2A1; Mon, 21 Oct 2013 16:42:24 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-wi0-x233.google.com (mail-wi0-x233.google.com [IPv6:2a00:1450:400c:c05::233]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4174B2475; Mon, 21 Oct 2013 16:42:24 +0000 (UTC) Received: by mail-wi0-f179.google.com with SMTP id hm4so4331406wib.0 for ; Mon, 21 Oct 2013 09:42:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=PTPCk3QmAYk3QxpI4TgjMn8vyXjIjXw9zjQWdshS8ss=; b=jucpwoRm/tMJyLl7Azd1nlGtG1TRDHDN12NOsqt60fKWJbBBEL/7RscUnazV86Wxnz sgxZ0P2CH7mMakJ2xeEk/v7mEP2fcgR8UlhtsCw859sdFwZjFzHYRV/dZwnBbBpK0hwe kILH7ZkTgbMb9sW1XzgiKdBT0zgRS+GV3acNHB0A0SR/q77S1kGMOOTsGFUXRnF1PnZ6 g2yasOOhLNkw9v5j3VXOX95/4hLH/BS/SQwinLrTPoVcdukrE6h7AWRXoN0MGSvI4g9d aB9BTFqKc2/+NJg4RZvpprhdvQ82FyvCQO3mPgS8UN+8lFCCKkjRpZ1+IKWf2VZbFXVG hx5g== MIME-Version: 1.0 X-Received: by 10.181.11.163 with SMTP id ej3mr10373668wid.47.1382373742563; Mon, 21 Oct 2013 09:42:22 -0700 (PDT) Sender: asomers@gmail.com Received: by 10.194.171.35 with HTTP; Mon, 21 Oct 2013 09:42:22 -0700 (PDT) In-Reply-To: <1382286899.92499.110.camel@revolution.hippie.lan> References: <1382192148.119437035@f257.i.mail.ru> <1382286899.92499.110.camel@revolution.hippie.lan> Date: Mon, 21 Oct 2013 10:42:22 -0600 X-Google-Sender-Auth: zuwx3rYZJy-iB5emjY_xyLJvdXc Message-ID: Subject: Re: determine drive's SAS port From: Alan Somers To: Ian Lepore Content-Type: text/plain; charset=ISO-8859-1 Cc: Alexey Egorov , 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: Mon, 21 Oct 2013 16:42:25 -0000 On Sun, Oct 20, 2013 at 10:34 AM, Ian Lepore 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 > 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 > > > > > _______________________________________________ > 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