Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 May 2003 10:03:29 +0100
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        "Wilkinson,Alex" <Alex.Wilkinson@dsto.defence.gov.au>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: disklabel/bsdlabel Question
Message-ID:  <20030509090329.GB21358@happy-idiot-talk.infracaninophile.co.uk>
In-Reply-To: <20030508113346.T16341@squirm.dsto.defence.gov.au>
References:  <20030508113346.T16341@squirm.dsto.defence.gov.au>

next in thread | previous in thread | raw e-mail | index | archive | help

--pvezYHf7grwyp3Bc
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, May 08, 2003 at 11:42:52AM +0930, Wilkinson,Alex wrote:

> If I want to change the block size and fragment size of a BSD partition w=
ill newfs use the
> changed values I make in the disklabel or do I still have to use newfs op=
tions to specify the
> fsize and bsize ?
>=20
> In other words, by changing the values of the disklabel, does this make t=
he new values the defaultfor newfs ?

Good question.  It's not entirely clear from the newfs(8) and
disklabel(8) man pages exactly what happens.

Turning to the source code we see:

in /usr/src/sbin/newfs.c:

Variables declared and initialized to zero

    [...]

    int     fsize =3D 0;              /* fragment size */
    int     bsize =3D 0;              /* block size */

    [...]

Values set from command line args, if present:

                case 'b':
                        if ((bsize =3D atoi(optarg)) < MINBSIZE)
                                fatal("%s: bad block size", optarg);
                        break;

    [...]

                case 'f':
                        if ((fsize =3D atoi(optarg)) <=3D 0)
                                fatal("%s: bad fragment size", optarg);
                        break;
   =20
    [...]

Read disklabel structure into 'lp' structure, and setup 'pp' as
convenience pointer to the list of partitions from the disk label.

            if (mfs && disktype !=3D NULL) {
                    lp =3D (struct disklabel *)getdiskbyname(disktype);
                    if (lp =3D=3D NULL)
                            fatal("%s: unknown disk type", disktype);
                    pp =3D &lp->d_partitions[1];

(pp is later adjusted to point to the entry for partition in question)

    [...]

If fsize and bsize have not yet been set to non-zero, use the value
=66rom the partition entry in the disklabel, or failing that either
(fsize) the default value from the parameters at the top of the
disklabel or (bsize) calculate from the fsize value.

            if (fsize =3D=3D 0) {
                    fsize =3D pp->p_fsize;
                    if (fsize <=3D 0)
                            fsize =3D MAX(DFL_FRAGSIZE, lp->d_secsize);
            }
            if (bsize =3D=3D 0) {
                    bsize =3D pp->p_frag * pp->p_fsize;
                    if (bsize <=3D 0)
                            bsize =3D MIN(DFL_BLKSIZE, 8 * fsize);
            }

    [...]

So, in short, the answer to your question is "yes".

	Cheers,

	Matthew

--=20
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK

--pvezYHf7grwyp3Bc
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (FreeBSD)

iD8DBQE+u27hdtESqEQa7a0RAlclAJ9GUnR8hEWlnQ7wcZFbHxJaIT9oiwCfT12X
wsBECCLj/vCuG4gbN6AmPUk=
=jEI3
-----END PGP SIGNATURE-----

--pvezYHf7grwyp3Bc--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030509090329.GB21358>