From owner-freebsd-hackers@FreeBSD.ORG Thu May 12 15:32:06 2005 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from green.homeunix.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id BC69416A4CE; Thu, 12 May 2005 15:32:05 +0000 (GMT) Received: from green.homeunix.org (green@localhost [127.0.0.1]) by green.homeunix.org (8.13.3/8.13.1) with ESMTP id j4CFW5vf087877; Thu, 12 May 2005 11:32:05 -0400 (EDT) (envelope-from green@green.homeunix.org) Received: (from green@localhost) by green.homeunix.org (8.13.3/8.13.1/Submit) id j4CFW4Wo087876; Thu, 12 May 2005 11:32:04 -0400 (EDT) (envelope-from green) Date: Thu, 12 May 2005 11:32:04 -0400 From: Brian Fundakowski Feldman To: Juho Vuori Message-ID: <20050512153204.GD2058@green.homeunix.org> References: <42836020.4050500@kepa.fi> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42836020.4050500@kepa.fi> User-Agent: Mutt/1.5.6i cc: freebsd-hackers@freebsd.org Subject: Re: Finding out names of mountable devices X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2005 15:32:06 -0000 On Thu, May 12, 2005 at 04:54:40PM +0300, Juho Vuori wrote: > Tried on freebsd-questions without an answer. I suppose this is not > doable, but I'll ask here anyway. > > If I plug in e.g. a USB thumb drive, which becomes, say, umass0. > Normally something like /dev/da0 will also be created and slices of that > device may be mounted. But is there a API for finding out what is the > corresponding block device for umass devices? The device driver writes > that to syslog, but reading logs for something like that is quite clumsy. One easy way is to look for changes in the GEOM topology: green# sysctl -b kern.geom.conftxt 0 DISK cd0 4627595264 2048 hd 0 sc 0 0 DISK ad0 164696555520 512 hd 16 sc 63 1 MBR ad0s1 164694749184 512 i 0 o 32256 ty 165 2 BSD ad0s1g 141340864512 512 i 6 o 23353884672 ty 7 2 BSD ad0s1f 21474836480 512 i 5 o 1879048192 ty 7 2 BSD ad0s1e 268435456 512 i 4 o 1610612736 ty 7 2 BSD ad0s1d 268435456 512 i 3 o 1342177280 ty 7 2 BSD ad0s1c 164694749184 512 i 2 o 0 ty 0 2 BSD ad0s1b 1073741824 512 i 1 o 0 ty 1 2 BSD ad0s1a 268435456 512 i 0 o 1073741824 ty 7 -- Brian Fundakowski Feldman \'[ FreeBSD ]''''''''''\ <> green@FreeBSD.org \ The Power to Serve! \ Opinions expressed are my own. \,,,,,,,,,,,,,,,,,,,,,,\