[comp.sys.sun] Newfs under SunOS4.1 reports file system sizes incorrectly

ehrlich@psuvax1.cs.psu.edu (Dan Ehrlich) (07/06/90)

I just noticed that when running newfs the file system size that is
reported is about 105% of what it should be.  For example

# newfs /dev/rid000h
/dev/rid000h:   159900 sectors in 130 cylinders of 15 tracks, 82 sectors
        81.9MB in 9 cyl groups (16 c/g, 10.08MB/g, 4608 i/g)

Using my trusty TI-55-II calculator to compute (159900*512)/1048576 yields
a result of 78.076172MB.  Even worse 9g * 10.08MB/g = 90.72MB, not 81.9MB.
This is off by about 12%.  Can anyone explain to me why these values would
be so far from what it would appear they should be?

Thanks.
Dan Ehrlich <ehrlich@cs.psu.edu>/Voice: +1 814 863 1142/FAX: +1 814 865 3176

jms@tardis.tymnet.com (Joe Smith) (07/11/90)

In article <9702@brazos.Rice.edu> ehrlich@psuvax1.cs.psu.edu (Dan Ehrlich) writes:
>/dev/rid000h:   159900 sectors in 130 cylinders of 15 tracks, 82 sectors
>        81.9MB in 9 cyl groups (16 c/g, 10.08MB/g, 4608 i/g)
>Using my trusty TI-55-II calculator to compute (159900*512)/1048576 yields
>a result of 78.076172MB.  Even worse 9g * 10.08MB/g = 90.72MB, not 81.9MB.

159900 * 512 = 81,868,800 = 81.9*10^6 bytes
16 cyls * 15 tracks * 82 sectors * 512 bytes = 10,076,160 = 10.08*10^6 bytes
130 cyls / (16 cyls/group) = 8.13 groups, must round up to 9 cyl groups

Given that 1M = 1,000,000 those numbers are accurate.

A lot of vendors are using the convention that "1 megabyte" of memory is
exactly 1,048,576 bytes, but "1 megabyte" of disk is 1,000,000 bytes.
(It's more impressive on the sales literature to say that you sell an 81
megabyte drive instead of a 78 megabyte drive.)

Joe Smith (408)922-6220 | SMTP: jms@tardis.tymnet.com or jms@gemini.tymnet.com
BT Tymnet Tech Services | UUCP: ...!{ames,pyramid}!oliveb!tymix!tardis!jms
PO Box 49019, MS-C41    | BIX: smithjoe | 12 PDP-10s still running! "POPJ P,"
San Jose, CA 95161-9019 | humorous dislaimer: "My Amiga speaks for me."

nobody@kodak.com (07/20/90)

In article <9843@brazos.Rice.edu> jms@tardis.tymnet.com (Joe Smith) writes:
>130 cyls / (16 cyls/group) = 8.13 groups, must round up to 9 cyl groups

One handy thing that I learned by taking a one morning tutorial from Dr.
Kirk McKusick on the fast file system was what cylinder groups were and
why they existed.  It was a few years ago, but I did remember that a
cylinder group is an entity that is a reference for certain things such as
the number of inodes/group.  So there is no such thing as a fractional
cylinder group, you may have 8 cylinder groups that are of the size 16
cylinders and 1 cylinder group which has only 2 cylinders in it, but you
do really have 9 cylinder group.  Newfs makes sure of that.  One of the
other things that is done by newfs in each cylinder group is to allocate
the inodes.  

Things may have changed with mkfs (please correct me if I am wrong), but
mkfs didn't used to do fractional inode allocations.  I.E.  It will
allocate 4608 inodes in your 2 cylinder - cylinder group, just the same as
it will in a 16 cylinder cylinder group.  (4608 i/g was contained in the
original posting).  

If you ever have a disk on a new system that you can play with formatting,
try making a cylinder group with just 2 cylinders in it.  You would be
amazed at how much of the file system is occupied by inodes. 

<S> - S curve - go slow.  Personally, I collect up what I would have put
in small cylinder groups, and often shift it into one partition to make at
least a 8 cylinder - cylinder group.  Otherwise I add it to the swap.  I
have tried to vary the number of cylinders per group (I did it a few years
ago on an Ultrix system), and although the option is there in newfs and
mkfs, it had absolutely *no* effect .. they all came out 16 cylinders per
group.  

I have been out of it (system administration) for a while you see. So
please test out some of the things that I have said, or check with someone
with source.  I still layout partitions always on even cylinder boundaries
with the mininmum size of a cylinder group being 8 cylinders.  Most of the
time I layout all partitions so that all cylinder groups have all 16
cylinders in them.  Any "left over" cylinders, I usually add to the swap
(which doesn't have a file system on it) -- if the disk has a partition
used for swap.

Hope this helps.

James H. Moore                            
User Services Coordinator
Eastman Kodak Company   
Rochester, NY 14653-5403    Email: jmoore@ssd.kodak.com