From owner-freebsd-bugs@FreeBSD.ORG Fri Jan 26 04:20:23 2007 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DC7E316A406 for ; Fri, 26 Jan 2007 04:20:23 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.freebsd.org (Postfix) with ESMTP id B4D9713C46E for ; Fri, 26 Jan 2007 04:20:23 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id l0Q4KNxp005188 for ; Fri, 26 Jan 2007 04:20:23 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id l0Q4KN7p005187; Fri, 26 Jan 2007 04:20:23 GMT (envelope-from gnats) Date: Fri, 26 Jan 2007 04:20:23 GMT Message-Id: <200701260420.l0Q4KN7p005187@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Bruce Evans Cc: Subject: Re: bin/108320: dumpfs(8) lists wrong file system size [PATCH?] X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Bruce Evans List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jan 2007 04:20:23 -0000 The following reply was made to PR bin/108320; it has been noted by GNATS. From: Bruce Evans To: Toby Burress Cc: freebsd-gnats-submit@freebsd.org, jmallett@freebsd.org Subject: Re: bin/108320: dumpfs(8) lists wrong file system size [PATCH?] Date: Fri, 26 Jan 2007 15:15:32 +1100 (EST) On Thu, 25 Jan 2007, Toby Burress wrote: > On Thu, Jan 25, 2007 at 06:56:23PM +1100, Bruce Evans wrote: >> On Wed, 24 Jan 2007, Toby Burress wrote: >> >>>> Description: >>> When using dumpfs(8) to check the file system size, and in particular >>> dumpfs -m to find a command that creates the file system, the size >>> listed is smaller than the actual size of the file system. >> >> No, dumpfs is correct. It just reports the size being used ffs. The >> size is in blocks (frags). This size is reported by dumpfs as `fsize`. > > If dumpfs is correct, then why are the file systems created with > the command `dumpfs -m` smaller than the original file systems? Sorry, I didn't notice that you wanted -m to work (I didn't know that -m existed). -m just never actually worked, except accidentally when the frag size equals the sector size. It prints "-s " but newfs's -s arg takes a size in sectors. These sizes normally differ by a factor of 4, since the frag size defaults to 2048 and most disks have a sector size of 512. Another bug in -m is that it conflicts with NetBSD's -m. It's bogus for newfs to take a size in sectors. The sector size is not recorded in struct fs or used by ffs. It just needs to be a divisor of the frag size (and maybe a power of 2). newfs normally determines it using a disk ioctl and only uses it to scale the sizes. This default can can be overridden by specifying the size using newfs -S or -T. Another bug: -T apparently clobbers any setting by -S, even if -S is after -T on the command line. Possible fixes: - use a disk ioctl in dumpfs, so as to reverse the conversion of units that newfs will do. I don't like this. It doesn't work if the file system is a copy of a disk in a regular file. - use a fake sector size: print "-S " in dumpfs. This should give identical results since ffs doesn't actually use the sector size, except newfs randomizes some things in the new file system. The undocumented -R flag can be used to avoid the randomness for testing. Bruce