Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Aug 2022 14:01:09 +1000
From:      Peter Jeremy <peterj@freebsd.org>
To:        freebsd-fs@freebsd.org
Subject:   ZFS bootfs vs vfs.root.mountfrom
Message-ID:  <YwmXBSn8W4QfkRVR@server.rulingia.com>

next in thread | raw e-mail | index | archive | help
--SMVHMpE6bcvqhvH5
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

When booting from ZFS was first introduced, the recommended approach
was to configure the root filesystem via vfs.root.mountfrom.  See (e.g.)
 https://lists.freebsd.org/pipermail/freebsd-fs/2011-September/012482.html
 https://lists.freebsd.org/pipermail/svn-src-head/2011-October/030641.html
and people wanted to change that to use the zpool bootfs property - e.g.
 https://lists.freebsd.org/pipermail/freebsd-current/2009-October/012933.ht=
ml
 https://lists.freebsd.org/pipermail/freebsd-fs/2010-March/008010.html
resulting in it becoming optional in SVN r235330 in May 2012:
 https://lists.freebsd.org/pipermail/svn-src-head/2012-May/036902.html

The recommendation to use vfs.root.mountfrom remains in parts of the
wiki (e.g. https://wiki.freebsd.org/RootOnZFS/GPTZFSBoot/Mirror step
2.6) and on mailing list posts (e.g. the thread starting at
https://lists.freebsd.org/pipermail/freebsd-fs/2020-July/028351.html).
The loader(8) and loader.conf(5) man pages state that the root
filesystem is set by vfs.root.mountfrom, with a default derived from
/etc/fstab or, for ZFS only, currdev (the boot filesystem).

OTOH, https://wiki.freebsd.org/BootEnvironments states "/etc/fstab
must be purged of any / mount, and /boot/loader.conf must not be
setting vfs.root.mountfrom directly."  I can't find any other
reference to this requirement.

As for the BootEnvironment management tools themselves:
* Neither beadm(8) nor bectl(8) mention vfs.root.mountfrom.
* beadm(8) refers to https://forums.freebsd.org/showthread.php?t=3D31662,
  which recommends setting vfs.root.mountfrom
* beadm(8) will update vfs.root.mountfrom in /boot/loader.conf if it
  exists but will not add it if it doesn't exist.
* bectl(8) ignores /boot/loader.conf

The last point means that switching an existing system from beadm to
bectl is very likely to result in the system mounting the wrong root
filesystem: An existing system is likely to have vfs.root.mountfrom
set, since that used to be the only approach and is still widely
recommended, whilst bectl ignores it and will therefore leave the
old vfs.root.mountfrom value present.

IMO, if setting vfs.root.mountfrom in /boot/loader.conf is no longer
supported for ZFS, we need to do a better job of documenting that and
removing documentation to the contrary.  I also believe that bectl
should at least warn if /boot/loader.conf sets vfs.root.mountfrom.

--=20
Peter Jeremy

--SMVHMpE6bcvqhvH5
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEE7rKYbDBnHnTmXCJ+FqWXoOSiCzQFAmMJlwBfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEVF
QjI5ODZDMzA2NzFFNzRFNjVDMjI3RTE2QTU5N0EwRTRBMjBCMzQACgkQFqWXoOSi
CzRarw//TJYrKPMr8oRzjBQs0f7ywE55qjT27lwVAQeFRUA573dxF1UvULezfS7I
7xR7OvLfK6R3PQWjFSzvlpTX/sShCuq/cY/ic3Clh6u3dneamLOVs2WoUQQtxWqS
Ic5qN0GFpT+esAujv83FsohG7OutfCKOqUf82jgQJIf2sRIW7j4hJCirgie2DeO3
AqNKKcY3for7NCp5Vl0rP4Kd8Y/5yDl0SZCDC/U4wg+x6A8LcycJrhGG9T2Bhh4x
H8KXPqJ8d7n/Cjj9dJ2kJeCFsMGqGGKglohS92nA7H7GUUgR0ai+lsXSujtMOJnU
K/GB+/LyQSh6uPJ52hwLvoRyHKTl3s2BBY42NX2XOSjhb3Ih/bL8RbrDXfjT8DRu
Id8QQ0wZT8r8r/Ykln1zhsxzP/hRoyWZDZHme4IjQMn6HqIFN9/iQZZDA3pKKCAB
r5YXwP5gE1hI14U5kluxyZHueEFFWQc2zY3GPzb0+4Fb+GpxCwqWEYVb6mjf0aNu
UFT0nQ4UFw3jnux3rHHPK3nqZNV+MzvD1RN/2ZRHc/EvfW8KwqhDlp4YrgpiASLl
Kjuw6mH7bteuZgkahXNTBOjOcVy9vPfahYgT4f/fTBjuwcV5H+AGm0I1y1W+a/Ui
W8gXe0vivmU9s6SPiTDrBh6AcePHzPx1uEll2ewoT9VkQEHsHEA=
=0pI/
-----END PGP SIGNATURE-----

--SMVHMpE6bcvqhvH5--



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