newfs, cylinder groups, and a few other things

Glenn Dawson glenn at antimatter.net
Mon Jul 11 05:08:33 GMT 2005


Recently while looking into a particular problem, I found some things in 
the code for newfs(8) that don't make sense to me.  Hopefully someone here 
can shed some light on things.

The maxblkspercg variable which can be set using the -c option is actually 
treated as if it were the max frags per cylinder group.  Slightly confusing 
when you specify max blocks and you end up with something a lot less.

The second thing I noticed is that fs_old_cpg in struct fs, is always set 
to 1 when creating a ufs1 file system.  The whole idea of cylinders and 
cylinder groups seems to have been rearranged so that what was previously a 
cylinder group, is now the same as a cylinder.  So instead of having a 
cylinder group with 16 cylinders and 8 blocks per cylinder for a total of 
128 blocks, you end up with 1 cylinder with 128 blocks.  Probably not a big 
deal in most cases, but a ufs1 file system created with newfs in 4.x has 
very different geometry than one created in 5.x.  It was that difference 
that brought my attention to this in the first place.

Lastly, I also noticed that the value written to the disk label which used 
to be the number of cylinders per group, is now fragments per group (or 
cylinder since the groups never have more than 1 cylinder).  The 
documentation for disklabel(8) doesn't mention this at all.

-Glenn



More information about the freebsd-fs mailing list