bin/108320: dumpfs(8) lists wrong file system size [PATCH?]

Bruce Evans bde at zeta.org.au
Fri Jan 26 04:20:23 UTC 2007


The following reply was made to PR bin/108320; it has been noted by GNATS.

From: Bruce Evans <bde at zeta.org.au>
To: Toby Burress <kurin at delete.org>
Cc: freebsd-gnats-submit at freebsd.org, jmallett at 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 <size in frags>"
 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 <frag size>" 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


More information about the freebsd-bugs mailing list