Why at least 4 cylinder groups?

Norbert Koch nkoch at demig.de
Tue Oct 11 06:52:21 UTC 2016



Am 2016-10-10 um 17:26 schrieb Rodney W. Grimes:
>> Hello.
>>
>> In an embedded system I am having a rather
>> small (static) ram disk of about 1.5MB,
>> formatted as UFS(1).
>>
>> Under FreeBSD 4 dumpfs shows me there is
>> 1 cylinder group.
>>
>> Under FreeBSD 9 and 10 I see 4 cylinder groups.
>>
>> 4 is hard coded as the minimum value in ufs/ffs/fs.h. Why?
> I beleive this constant only applies to UFS version 2, newfs -O 2,
> which is default in FreeBSD 9 and 10.
>
>> Is there any technical reason not to have less
>> than 4 cylinder groups?
> Probably on a UFS2 file system yes, but as far as I can
> see not on a UFS1 file system.
>
>> For my application the wasted 188KB make a difference.
> Try:
> 	newfs -O 1

I already use UFS1.

I compiled newfs with MINCYLGRPS=1.
This is what dumpfs gives me before and after:

--- //Entw-pr2/nk/x/de95b    Mon Oct 10 13:07:47 2016
+++ //Entw-pr2/nk/x/de95c    Mon Oct 10 14:27:52 2016
@@ -1,19 +1,19 @@
-magic    11954 (UFS1)    time    Mon Oct 10 11:07:39 2016
-id    [ 57fb7662 72cbad24 ]
-ncg    4    size    3072    blocks    2143
+magic    11954 (UFS1)    time    Mon Oct 10 12:29:18 2016
+id    [ 57fb8985 18e78a1d ]
+ncg    1    size    3072    blocks    2247
  bsize    4096    shift    12    mask    0xfffff000
  fsize    512    shift    9    mask    0xfffffe00
  frag    8    shift    3    fsbtodb    0
  minfree    8%    optim    time    symlinklen 60
  maxbpg    512    maxcontig 32    contigsumsize 16
-nbfree    258    ndir    4    nifree    3189    nffree    30
-cpg    1    bpg    97    fpg    776    ipg    800
+nbfree    273    ndir    4    nifree    3061    nffree    13
+cpg    1    bpg    384    fpg    3072    ipg    3072
  nindir    1024    inopb    32    nspf    1    maxfilesize 4402345721855
-sbsize    1536    cgsize    512    cgoffset 0    cgmask 0xffffffff
-csaddr    256    cssize    512
+sbsize    1536    cgsize    1536    cgoffset 0    cgmask 0xffffffff
+csaddr    824    cssize    512
  rotdelay 0ms    rps    60    trackskew 0    interleave 1
-nsect    776    npsect    776    spc    776
-sblkno    32    cblkno    48    iblkno    56    dblkno    256
+nsect    3072    npsect    3072    spc    3072
+sblkno    32    cblkno    48    iblkno    56    dblkno    824
  cgrotor    0    fmod    0    ronly    0    clean    0
  avgfpdir 64    avgfilesize 16384
...


So, afaics technically one cylinder group would be ok for UFS1, right?


More information about the freebsd-hackers mailing list