From owner-freebsd-stable@FreeBSD.ORG Mon Jan 5 19:24:00 2009 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 47F9E1065672 for ; Mon, 5 Jan 2009 19:24:00 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (unknown [IPv6:2a01:170:102f::2]) by mx1.freebsd.org (Postfix) with ESMTP id B06848FC0C for ; Mon, 5 Jan 2009 19:23:59 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (localhost [127.0.0.1]) by lurza.secnetix.de (8.14.3/8.14.3) with ESMTP id n05JNrXW038326; Mon, 5 Jan 2009 20:23:54 +0100 (CET) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.14.3/8.14.3/Submit) id n05JNrwt038325; Mon, 5 Jan 2009 20:23:53 +0100 (CET) (envelope-from olli) Date: Mon, 5 Jan 2009 20:23:53 +0100 (CET) Message-Id: <200901051923.n05JNrwt038325@lurza.secnetix.de> From: Oliver Fromme To: freebsd-stable@FreeBSD.ORG, david@catwhisker.org In-Reply-To: <20090102153455.GR4100@albert.catwhisker.org> X-Newsgroups: list.freebsd-stable User-Agent: tin/1.8.3-20070201 ("Scotasay") (UNIX) (FreeBSD/6.4-PRERELEASE-20080904 (i386)) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.1.2 (lurza.secnetix.de [127.0.0.1]); Mon, 05 Jan 2009 20:23:54 +0100 (CET) Cc: Subject: Re: newfs(8) parameters from "dumpfs -m" have bad -s value? X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-stable@FreeBSD.ORG, david@catwhisker.org List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jan 2009 19:24:00 -0000 David Wolfskill wrote: > pool10(7.1-RC1)[32] df -ki /dev/da1s1d > Filesystem 1024-blocks Used Avail Capacity iused ifree %iused Mounted on > /dev/da1s1d 1702753030 4 1566532784 0% 2 220046332 0% /b > > Here's what dumpfs(8) says: > > pool10(7.1-RC1)[36] dumpfs -m /dev/da1s1d > # newfs command for /dev/da1s1d (/dev/da1s1d) > newfs -O 2 -U -a 8 -b 16384 -d 16384 -e 2048 -f 2048 -g 16384 -h 64 -m 8 -o time -s 879031908 /dev/da1s1d This seems to be a bug in dumpfs(8). It simply prints the value of the fs_size field of the superblock, which is wrong. The -s option of newfs(8) expects the available size in sectors (i.e. 512 bytes), but the fs_size field contains the size of the file system in 2KB units. This seems to be the fragment size, but I'm not sure if this is just coincidence (the docs state that it's the size in blocks, but this is misleading because the blocksize is usually different; the default is 16K). So, dumpfs(8) needs to be fixed to perform the proper calculations when printing the value for the -s option. Unfortunately I'm not sufficiently much of a UFS guru to offer a fix. My best guess would be to multiply the fs_size value by the fragment size (measured in 512 byte units), i.e. multiply by 4 in the most common case. But I'm afraid the real solution is not that simple. Best regards Oliver -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M. Handelsregister: Registergericht Muenchen, HRA 74606, Geschäftsfuehrung: secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün- chen, HRB 125758, Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd (On the statement print "42 monkeys" + "1 snake":) By the way, both perl and Python get this wrong. Perl gives 43 and Python gives "42 monkeys1 snake", when the answer is clearly "41 monkeys and 1 fat snake". -- Jim Fulton