newfs(8) parameters from "dumpfs -m" have bad -s value?

Danny Braniss danny at cs.huji.ac.il
Tue Jan 6 06:51:23 UTC 2009


> On Mon, Jan 05, 2009 at 08:23:53PM +0100, Oliver Fromme wrote:
> > 
> > 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
> 
> This *is* the fragment size.  UFS/FFS uses the plain term "block" to mean
> the fragment size.  All blocks are indexed with this number, unlike "block
> size" which is almost always 8 fragments ("blocks").  Confusing.
> 
> > 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.
> 
> The sector size and filesystem size parameters in newfs are remnants.
> Everything is converted to number of media sectors (sector size as
> specified by the device).  So one could assume for dumpfs to always use
> 512, since it's rarely different, and multiply fs_size by fs_fsize and
> divide by 512, and then output "-S 512".
> 

don't assume 512, in the iscsi world I have seen all kinds of sector sizes,
making it a PITA to get things right.

> Better yet would be to add a parameter ("-z" perhaps) to newfs(8) to accept
> number of bytes instead of multiples of sectorsize.
> 
> I would be willing to write up patches for dumpfs and newfs to both add the
> raw byte size and the 512-byte sector size handling to correct said
> mistake, unless someone else would rather.
> 
> -- Rick C. Petty
> _______________________________________________
> freebsd-stable at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-stable
> To unsubscribe, send any mail to "freebsd-stable-unsubscribe at freebsd.org"
> 




More information about the freebsd-stable mailing list