Subject: Re: HDD-woes on Sparcstation 5
To: None <port-sparc@NetBSD.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: port-sparc
Date: 11/19/2006 23:39:09
>>>> #        size    offset     fstype [fsize bsize cpg/sgs]
>>>>  d:    392000    522480     4.2BSD   1024  8192 39200 
>>>                                                  ^^^^^
>>> How do you calculate "cpg/sgs"?
>> By taking the bottom 16 bits of number of fragments in a 'cylinder
>> group'.
> (In particular, where/how do you find the value for "number of
> fragments"?

As I understand it - which understanding may well be out of date - you
don't need to; newfs rewrites the disklabel, putting the appropriate
value there, when you make the filesystem.

> I thought fragmentation of a file system increases with use, or is
> that another problem entirely?)

Different meanings of "fragment".

Fragmentation such as you are speaking of refers to files stored
noncontiguously, something which FFS actually resists fairly well
provided you don't run it right out of space - this is one reason there
is a percentage of the space that's reserved for root.  (Performance is
the principal other reason.)

Fragments such as are in the "number of fragments in a cylinder group"
comment are a different thing entirely.  FFS divides the filesystem up
into `blocks' (size in the "bsize" column, 8192 above), which are
further subdivided into `fragments' (size in the "fsize" column, 1024
above).  A file too small to use indirect blocks will store its
contents in zero or more full blocks plus up to one block's worth of
fragments.  This gives most of the space efficiency of using an
allocation grain as small as a fragment with most of the performance
gain of using an allocation grain as large as a block.  (When a file
gets big enough to use indirect blocks, this is scrapped, and full
blocks are always used.)

At least that's for FFS1.  I haven't looked at FFS2 enough to know how
accurate the above is there.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B