From owner-freebsd-stable@FreeBSD.ORG Wed Mar 5 13:03:05 2008 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B01131065671 for ; Wed, 5 Mar 2008 13:03:05 +0000 (UTC) (envelope-from jdc@parodius.com) Received: from mx01.sc1.parodius.com (mx01.sc1.parodius.com [72.20.106.3]) by mx1.freebsd.org (Postfix) with ESMTP id 9A4218FC2E for ; Wed, 5 Mar 2008 13:03:05 +0000 (UTC) (envelope-from jdc@parodius.com) Received: by mx01.sc1.parodius.com (Postfix, from userid 1000) id 9280F1CC033; Wed, 5 Mar 2008 05:03:05 -0800 (PST) Date: Wed, 5 Mar 2008 05:03:05 -0800 From: Jeremy Chadwick To: Rick van der Zwet Message-ID: <20080305130305.GA25277@eos.sc1.parodius.com> References: <47CE70E0.4000607@wirelessleiden.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <47CE70E0.4000607@wirelessleiden.nl> User-Agent: Mutt/1.5.16 (2007-06-09) Cc: freebsd-stable@freebsd.org Subject: Re: Mapping stat(1) device number/name to partition? X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Mar 2008 13:03:05 -0000 On Wed, Mar 05, 2008 at 11:07:28AM +0100, Rick van der Zwet wrote: > Hi all, > > I am looking for a way to detect the file system a certain file lives > and next whether this file system is mounted/accessible as writable. [1] > > As stat(1) is helping me out to found out the proper device name/number > of a certain file with the command `stat -f "%d" /etc/motd`, but next > will be the mapping from this device number (st_dev) to the proper > partion/mount point. > > Which handy shell utility program will help me doing this? fstat(1) sounds like it might be of help here. If you're writing a C program for this, the source code is in src/usr.bin/fstat. > [1] Part of getting rid of the annoying motd update failure message, > when /etc is not writable. I know setting update_motd=NO in > /etc/rc.conf will do the trick as well, but I would like to see him > detecting it auto-magically ;-) I haven't seen the "auto-updating motd" feature of FreeBSD since the 3.x days. Are you referring to the "annoyance" where during mergemaster(1), you can nuke your /etc/motd? If so, try IGNORE_MOTD=yes in /etc/mergemaster.rc. -- | Jeremy Chadwick jdc at parodius.com | | Parodius Networking http://www.parodius.com/ | | UNIX Systems Administrator Mountain View, CA, USA | | Making life hard for others since 1977. PGP: 4BD6C0CB |