From owner-freebsd-hackers@FreeBSD.ORG Fri Dec 26 11:59:12 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 3AA3A1065673 for ; Fri, 26 Dec 2008 11:59:12 +0000 (UTC) (envelope-from unixmania@gmail.com) Received: from fk-out-0910.google.com (fk-out-0910.google.com [209.85.128.186]) by mx1.freebsd.org (Postfix) with ESMTP id B888F8FC08 for ; Fri, 26 Dec 2008 11:59:11 +0000 (UTC) (envelope-from unixmania@gmail.com) Received: by fk-out-0910.google.com with SMTP id k31so2847971fkk.11 for ; Fri, 26 Dec 2008 03:59:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=PBoisr5KcH4cIKAvPCzx47ALvTS1l+XpzYlneTIh7PY=; b=GQLFRwuf2aCr4FlmfNe5+Ccqcew38QB3yqW7H1G+PffGeefDaMuVCO4leCheg+myKO bZwmt0DN9BPi4N/DP6Hf6ZFawQnIn5SwZJBcT4HBqSZCbrrutnula2JPq6KpWl1zJc1H S0aKjMZL0EunfijiPZzV4JUamGQggGWl3B3XI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=NK6PM69+F14eGZKAiddFpEw5bI7EzPlFa+839lO+i6N8omAchABXWsiXaYRQmxQ9g3 dBx89XVBwcIqsia46Y3GH7c5bgmhTNgKLL9V49oCTJp4jH/6dUyhmi8vUQh2tQj7nA15 ot5cFvx6tmysL5fMWqaadW9h3QvH9RJmT5MnQ= Received: by 10.103.24.11 with SMTP id b11mr3800609muj.76.1230291088090; Fri, 26 Dec 2008 03:31:28 -0800 (PST) Received: by 10.103.137.8 with HTTP; Fri, 26 Dec 2008 03:31:27 -0800 (PST) Message-ID: Date: Fri, 26 Dec 2008 09:31:27 -0200 From: "Carlos A. M. dos Santos" To: "David Wolfskill" In-Reply-To: <20081226063946.GX4100@albert.catwhisker.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20081226011402.GP4100@albert.catwhisker.org> <20081226012224.2fbd579a@gluon> <20081226014956.GR4100@albert.catwhisker.org> <20081226063542.GA20518@shark.localdomain> <20081226063946.GX4100@albert.catwhisker.org> Cc: hackers@freebsd.org, Sergey Zaharchenko 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 11:59:12 -0000 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' -- cd /usr/ports/sysutils/life make clean