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

Oliver Fromme olli at lurza.secnetix.de
Mon Jan 5 19:24:00 UTC 2009


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


More information about the freebsd-stable mailing list