Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Aug 2012 14:27:28 -0700
From:      Jeremy Chadwick <jdc@koitsu.org>
To:        freebsd-stable@freebsd.org
Subject:   FreeBSD 9.x default filesystem layout and installworld
Message-ID:  <20120822212728.GA3561@icarus.home.lan>

next in thread | raw e-mail | index | archive | help
(Please keep me CC'd, as I am not subscribed to the list)


With the release of FreeBSD 9.0-RELEASE that the default filesystem
layout (specifically the "Guided" -> "Entire Disk" choice) is to have a
single filesystem (/).  Shown here:

http://www.freebsd.org/doc/handbook/bsdinstall-partitioning.html

I'm not against this idea (I'm well-aware of the pros and cons), but
there seems to be a conundrum here.  The Handbook:

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html

...says in Section 25.7.1 and 25.7.5 to use "mount -u /" (effectively
the same thing as "mount -u -w /").  But neither /usr/src/UPDATING nor
/usr/src/Makefile (the latter being more important if you ask me)
mention this fact.

Section 25.7.10 -- which is explicitly for installworld -- says nothing
about needing this.  Yet, if you don't, installworld will fail
complaining that the root filesystem is read-only:

Trying to mount root from ufs:/dev/da0p2 [rw]...
Enter full pathname of shell or RETURN for /bin/sh:
# cd /usr/src
# make installworld
mktemp: mkdtemp failed on /tmp/install.k0ti89Mb: Read-only file system
"/usr/src/Makefile.inc1", line 186: warning: "/usr/bin/mktemp -d -u -t install"
returned non-zero status
mkdir -p
usage: mkdir [-pv] [-m mode] directory_name
*** Error code 64

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.
# mount
/dev/da0p2 on / (ufs, local, read-only)
devfs on /dev (devfs, local, multilabel)

Thus:

# mount -u /
# make installworld
{...works fine...}

That got me wondering: in all my years of having separate filesystems,
I've never had to "mount -u /" after booting into SU and doing an
installworld -- which updates contents in /lib (key point there).  So
what's doing it?

The answer is "mount -a" or "mount -a -t ufs", which most of us do to
mount things like /usr, /var, and /tmp when in SUM.  /etc/fstab
obviously says / should be mounted rw and "mount -a" does in fact honour
that.  Per the man page (last part is what's important):

  -a      All the file systems described in fstab(5) are mounted.  Excep-
          tions are those marked as ``noauto'', those marked as ``late''
          (unless the -l option was specified), those excluded by the -t
          flag (see below), or if they are already mounted (except the root
          file system which is always remounted to preserve traditional
          single user mode behavior).

Verification:

# reboot
{...}
Trying to mount root from ufs:/dev/da0p2 [rw]...
Enter full pathname of shell or RETURN for /bin/sh:
# mount
/dev/da0p2 on / (ufs, local, read-only)
devfs on /dev (devfs, local, multilabel)
# mount -a -t ufs
# mount
/dev/da0p2 on / (ufs, local, journaled soft-updates)
devfs on /dev (devfs, local, multilabel)

Either way, the documentation should be updated (both in the Handbook
and in /usr/src/Makefile) to reflect this need (either "mount -u /" or
"mount -a -t ufs", even on systems with only one filesystem).

And while I'm here: this line in /usr/src/Makefile has been wrong for
quite some time (over a decade):

#  5.  `reboot'        (in single user mode: boot -s from the loader prompt).

That should be "shutdown -r now".  Yes there is a quite a difference.
However, just to make it clear, the "reboot" in step 10 is correct.

I can file a PR for all of this, but the /usr/src/Makefile modifications
are not maintained by the doc team so I imagine someone with src commit
bits would need to fix that.

HTH, or at least food for thought.

-- 
| Jeremy Chadwick                                   jdc@koitsu.org |
| UNIX Systems Administrator                http://jdc.koitsu.org/ |
| Mountain View, CA, US                                            |
| Making life hard for others since 1977.             PGP 4BD6C0CB |




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