From owner-freebsd-hackers@FreeBSD.ORG Fri Dec 26 13:21:01 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 3943D1065673 for ; Fri, 26 Dec 2008 13:21:01 +0000 (UTC) (envelope-from sean@gothic.net.au) Received: from visi.gothic.net.au (unknown [IPv6:2001:388:f000::5d]) by mx1.freebsd.org (Postfix) with ESMTP id D542F8FC1A for ; Fri, 26 Dec 2008 13:21:00 +0000 (UTC) (envelope-from sean@gothic.net.au) Received: from localhost (localhost [127.0.0.1]) by visi.gothic.net.au (Postfix) with ESMTP id 24A76A75D6; Sat, 27 Dec 2008 00:20:37 +1100 (EST) X-Virus-Scanned: amavisd-new at gothic.net.au Received: from localhost ([127.0.0.1]) by localhost (visi.gothic.net.au [127.0.0.1]) (amavisd-new, port 10026) with SMTP id WvcXa7lQuX+7; Sat, 27 Dec 2008 00:20:33 +1100 (EST) Received: from [IPv6:2002:9665:dd80:1:20f:eaff:fe8e:4927] (wxp.gothic.net.au [IPv6:2002:9665:dd80:1:20f:eaff:fe8e:4927]) (Authenticated sender: sean) by visi.gothic.net.au (Postfix) with ESMTPA id 77F34A75D2; Sat, 27 Dec 2008 00:20:33 +1100 (EST) Message-ID: <4954DA22.5000904@gothic.net.au> Date: Sat, 27 Dec 2008 00:20:34 +1100 From: Sean User-Agent: Thunderbird 2.0.0.18 (Windows/20081105) MIME-Version: 1.0 To: "Carlos A. M. dos Santos" References: <20081226011402.GP4100@albert.catwhisker.org> <20081226012224.2fbd579a@gluon> <20081226014956.GR4100@albert.catwhisker.org> <20081226063542.GA20518@shark.localdomain> <20081226063946.GX4100@albert.catwhisker.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed 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 13:21:01 -0000 Carlos A. M. dos Santos wrote: > On Fri, Dec 26, 2008 at 4:39 AM, David Wolfskill wrote: >> On Fri, Dec 26, 2008 at 09:35:42AM +0300, Sergey Zaharchenko wrote: >>> ... >>> Some of the stuff you want can be found here: >>> >>> root@shark:~# file -s /dev/ufs/home >>> /dev/ufs/home: Unix Fast File system [v2] (little-endian) last mounted on /home, volume name home, last written at Fri Dec 26 06:33:07 2008, clean flag 0, readonly flag 0, number of blocks 13631488, number of data blocks 13202246, number of cylinder groups 145, block size 16384, fragment size 2048, average file size 16384, average number of files in dir 64, pending blocks to free 4, pending inodes to free 0, system-wide uuid 0, minimum percentage of free blocks 8, TIME optimization >>> >>> You probably want the clean flag (which is 0 for me because that device >>> node is mounted). >> Very nice; thanks! Seems that both ffsinfo(8) & file(1) can do the job >> quickly; dumpfs(8) can do it, but takes around 33 seconds for a 400 GB >> file system (because it also dumps the cylinder groups). > > Be warned that file(1) resides at /usr/bin and depends on > /usr/share/misc/magic*, so it may not be available in early boot > stages, when /usr is not mounted yet. The following combination will > suffice, and depends only on /sbin and /stand: > > /sbin/ffsinfo -l 1 /usr/local | /rescue/sed -n 's/^clean *int8_t > *\(.*\)/\1/p' > Except FreeBSD hasn't had /stand for a long while, and there's no /rescue/sed (at least on 6.x and 7.x). Also, /stand was only ever populated on install and there's no guarantees it was ever up to date.