Subject: Re: Disklabel: "cpg/sgs"
To: <>
From: David Laight <david@l8s.co.uk>
List: netbsd-users
Date: 12/13/2004 20:28:10
> > I split a 6 GB slice into two slices with disklabel -e and then
> > newfs -b 8192 -f 1024 /dev/rsd0a (and 0f)
> > the cpg/sgs changed from "29" to "46xxx".
> 
> From "man 5 disklabel":
> 	(which describes the disk label data structure, as opposed to 
> 	the "man 8 disklabel", which describes the disklabel command)
> 
>     union {
> 	u_int16_t cpg;  /* UFS: FS cylinders per group */
> 	_int16_t sgs;  /* LFS: FS segment shift */
>     } __partition_u1;
>     #define p_cpg   __partition_u1.cpg
>     #define p_sgs   __partition_u1.sgs
> 
> Further information of the cpg parameter can be found in man newfs, of the
> sgs parameter in man newfs_lfs. 
> 
> newfs consults thedisk label to find out what values to use, if you don't 
> give it explicit values, then writes the used values back to the label.

All very interesting, except that, since the merge of the FFSv2 code,
newfs/mkfs.c contains pp->p_cpg = sblock.fs_fpg;

So the field contains the bottom 16 bits of the number of fragments
in a 'cylinder group' (which are no longer cylinder aligned!)

I suspect the person who imported the code forgot to update the docuentation.

The size of teh cylinder groups created by newfs doesn't depend on info
from the disklabel any more.

	David

-- 
David Laight: david@l8s.co.uk