Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Sep 2016 16:19:00 +0100
From:      Matthew Seaman <matthew@FreeBSD.org>
To:        freebsd-questions@freebsd.org
Subject:   Re: 10.3 zpool/var canmount = off?
Message-ID:  <4bd29396-220a-e198-73b9-0de91b74d096@FreeBSD.org>
In-Reply-To: <CA8E95A8-DFBA-488D-9060-1F2694E146EF@gmail.com>
References:  <CA8E95A8-DFBA-488D-9060-1F2694E146EF@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--8uKEEBhhf1xf4GJfL9M4D5aRN1SP5qIjI
Content-Type: multipart/mixed; boundary="j0TEXLnRCFlGrfb6n0FXE6LItWT3phmj3";
 protected-headers="v1"
From: Matthew Seaman <matthew@FreeBSD.org>
To: freebsd-questions@freebsd.org
Message-ID: <4bd29396-220a-e198-73b9-0de91b74d096@FreeBSD.org>
Subject: Re: 10.3 zpool/var canmount = off?
References: <CA8E95A8-DFBA-488D-9060-1F2694E146EF@gmail.com>
In-Reply-To: <CA8E95A8-DFBA-488D-9060-1F2694E146EF@gmail.com>

--j0TEXLnRCFlGrfb6n0FXE6LItWT3phmj3
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 2016/09/14 15:47, Oscar Hodgson wrote:
> New 10.3 install and I just noted that canmount is set off (local).
> So it serves only to provide a root for other var pools (okay) and a
> number of /var sub-directories wind up on the root file system (e.g.
> /var/db, /var/cache).
>=20
> Is there any specific reason why that choice was made?
>=20
> I working on updating / replacing a 9.0 mfsroot image we use to pxe
> boot machines (and decided to pass on 9.3).  That image set up /var
> within rc.conf (varmfs=3D=E2=80=9CYES=E2=80=9D, populate_var=3D=E2=80=9C=
YES=E2=80=9D), but everything
> there disappears when the machine powers off at the end of the day =E2=80=
=A6
> and part of my objective is to minimize the size of root.
>=20
> Mostly curiosity (and my next step it to =E2=80=9Cfix=E2=80=9D canmount=
), just
> thought I=E2=80=99d ask.

The layout generated by the installer puts as much as possible into a
single 'root' ZFS set up as a boot environment 'zroot/ROOT/default' that
you can immediately drop into beadm(1) to manage updates etc.  This
single ZFS is then easier to manage for operations like using 'zfs send'
to clone the system somewhere else. While beadm(1) will cope perfectly
well with a more complicated tree of ZFSes in each boot environment,
having a tree of ZFSes does make the tricks you can do with zfs
send/recv quite a lot more bothersome.

The root ZFS contains large chunks of the content under /var by default,
but not all of it.

The point of having zroot/var (with canmount=3Doff) that just acts as a
placeholder is so that eg. zroot/var/log or zroot/var/tmp (which you'll
see have 'canmount=3Don') get mounted in the right location in the file
system without becoming part of any boot environment.  That means
there's only one copy of those filesystems and it always gets mounted
every time you reboot -- which is really what you want for eg. /var/log
but not correct for boot environments in general.  Usually you'll have
several available, but only one of them should be mounted and active.

Your current setup using pxeboot and varmfs is behaving as expected.
varmfs creates /var as a memory file system -- ie. one without a long
lived backing store.  It's expected to be destroyed when the system
shuts down and recreated from scratch on bootup.

If you want content under /var to survive reboots  (for example, the
package database in /var/db/pkg is a PITA to have to regenerate...),
then you'll need to store it on something other than a mfs -- and you
can use the 'canmount=3Doff' concept to create a ZFS overlay on top of an=

mfs to do that.  (Although getting everything mounted in the right
sequence there is going to be a bit tricky.)

	Cheers,

	Matthew


--j0TEXLnRCFlGrfb6n0FXE6LItWT3phmj3--

--8uKEEBhhf1xf4GJfL9M4D5aRN1SP5qIjI
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org

iQJ8BAEBCgBmBQJX2WptXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQxOUYxNTRFQ0JGMTEyRTUwNTQ0RTNGMzAw
MDUxM0YxMEUwQTlFNEU3AAoJEABRPxDgqeTnmCQP/2w57jCUXck7qVyluEFIWXtt
nJoZNk9T4KcvY3/Ige60uZi+qmCCAZtPQTt06dI0HpZzYe4hSKDHFdcd8A1tTrKV
xV6skZsPfUSkgN4Lch0l31vmgHwR+nGej0FhyACJrjHQ6ubLGaicNke1frObAoiz
GHRXJapt2wFBw620RYxirg3csDIK5AXLsuiw4Imcqfb7knXxjWVYHH1B0AMEbWBd
XIWcb8A0yA9iW0LMRrf15Q+mNZB4f1wVaULcpRGwFoLL5c2x/yjevO1odxvOScJN
4W4IQPuPIRLt3O4QpSFPzUDNtj/UdNUUKnsMYylBLPP8DzvAp3e/IYqYDMbrpb3P
WTnHCct56Z//9jQDZd1rkUfnIdBkLyQ5L5biibIIVIsuO3ZM7cfq5OOdWudiDYlI
ZDpo3x4IPpGtZEt9eKRdNl/vP0Nrf6rAfOss62Lm7cpYRaktfFkW0KhSwTpxF0uc
h+k8xUyMgHzxqKOfuJhBwhFnzQdSJ1TdqytFoM2/4aptTSkgU3EIaK/IbAphmYn9
jeelXByrIrC+I1G2qJg6NfvEPPWc2Yb4RRvoXPTk/MLkByJh2VplnJSaxHhe6Vp5
cNO2FGfe/XBUNItBd26dPt21f8IP69q5VCaADmmFGAVYT5BHauyGxJBoChkhaJjT
hg3TZv8RH+XYiASb67Yr
=5FY+
-----END PGP SIGNATURE-----

--8uKEEBhhf1xf4GJfL9M4D5aRN1SP5qIjI--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4bd29396-220a-e198-73b9-0de91b74d096>