From owner-freebsd-hackers@FreeBSD.ORG Fri Dec 26 01:22:31 2008 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3ED9E1065670 for ; Fri, 26 Dec 2008 01:22:31 +0000 (UTC) (envelope-from bruce@cran.org.uk) Received: from muon.cran.org.uk (brucec-1-pt.tunnel.tserv4.nyc4.ipv6.he.net [IPv6:2001:470:1f06:c09::2]) by mx1.freebsd.org (Postfix) with ESMTP id F08118FC16 for ; Fri, 26 Dec 2008 01:22:30 +0000 (UTC) (envelope-from bruce@cran.org.uk) Received: from muon.cran.org.uk (localhost [127.0.0.1]) by muon.cran.org.uk (Postfix) with ESMTP id C3871192D5; Thu, 25 Dec 2008 20:22:29 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on muon X-Spam-Level: X-Spam-Status: No, score=-2.0 required=8.0 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.2.5 Received: from gluon (unknown [IPv6:2a01:348:10f:0:240:f4ff:fe57:9871]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by muon.cran.org.uk (Postfix) with ESMTPSA; Thu, 25 Dec 2008 20:22:29 -0500 (EST) Date: Fri, 26 Dec 2008 01:22:24 +0000 From: Bruce Cran To: David Wolfskill Message-ID: <20081226012224.2fbd579a@gluon> In-Reply-To: <20081226011402.GP4100@albert.catwhisker.org> References: <20081226011402.GP4100@albert.catwhisker.org> X-Mailer: Claws Mail 3.3.1 (GTK+ 2.12.9; i486-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: hackers@freebsd.org Subject: Re: How to quickly determine if UFS2 FS is "clean" from command line? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Dec 2008 01:22:31 -0000 On Thu, 25 Dec 2008 17:14:02 -0800 David Wolfskill wrote: > At work, we have some machines we're setting up that have a fair > amount of UFS2 "scratch space." > > While we would prefer to leave the file systems in question intact > iff they are "clean," we do not want to run fsck(8) against them > if they are not (because we expect that it would take too long); > rather, we want to merely recreate them (with newfs(8)). > > While I might be able to hack something together by cribbing > appropriate bits of fsck_ffs(8), I'm a great deal more comfortable > cobbling up glue scripts and the like -- I don't fancy myself all > that much of a C coder. > > Anyone know of a reasonable way to quickly determine whether or not > a UFS2 file system is clean from the command line? dumpfs will tell you the status of the 'clean' flag: dumpfs /dev/ad0s1d | grep clean That will output a line like: cgrotor 0 fmod 0 ronly 0 clean 1 Just like with fsck you can also tell dumpfs the previous mountpoint too and it'll use the right device. -- Bruce Cran