"mount -a -o rdonly" doesn't work (very well)

From: Robert Watson <rwatson_at_FreeBSD.org>
Date: Sat, 17 Nov 2007 17:23:51 +0000 (GMT)
I noticed this morning while testing some buggy kernel code that a system 
tested in single-user mode was coming back up with an unclean root file 
system.  Turns out, I'd been running "mount -a -o rdonly" to mount /usr before 
running tests, and while /usr had come up read-only, the mount command had 
also remounted / as writable -- not my intended result!  I was wondering if 
someone familiar with the mount flags/etc could take a look at this.  Here's 
the output:

(boot single-user)

# mount
/dev/ad0s1a on / (ufs, local, read-only)
devfs on /dev (devfs, local)
# mount -a -o rdonly
# mount
/dev/ad0s1a on / (ufs, local, soft-updates)
devfs on /dev (devfs, local)
/dev/ad0s1e on /usr (ufs, local, read-only)
# mount -a -o rdonly
/dev/ad0s1a on / (ufs, loal, read-only, soft-updates)
devfs on /dev (devfs, local)
/dev/ad0s1e on /usr (ufs, local, read-only)

As you can see, a somewhat odd sequence, as first the read only flag is 
removed from /, and then re-added the second time.

Robert N M Watson
Computer Laboratory
University of Cambridge
Received on Sat Nov 17 2007 - 16:24:13 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:22 UTC