Fwd: how to mount r/w encrypted partition when it is mount ad read-only?

Polytropon freebsd at edvax.de
Thu Feb 13 12:29:09 UTC 2014

On Thu, 13 Feb 2014 12:10:47 +0330, s m wrote:
> hello all
> i have an encrypted user partition which is encrypted with geli. user is
> mounted read-only. i want to mount it r/w for a short time, copy some files
> on it and mount it read-only again. with unencrypted partitions, we can
> change mount options. for example if an unencrypted user partition is
> read-only mounted, we can mount it r/w by "mount -rw  /usr" command. but
> for encrypted partitions this command doesn't work and error "device busy"
> occurs.
> is there any way to mount r/w encrypted partition when it is mounted as
> read-only?

See "man mount" and find the -u option: It updates the mount
status from r/o to r/w as specified (and back). You could do
this as follows, assuming the required options have already
been set in /etc/fstab (e. g. /crypt is where the encrypted
partition is currently mounted at in read-only mode)

	# mount -u -o rw /crypt
		... now copy some stuff to /crypt ...
	# mount -u -o ro /crypt

Of course, using "-uw" and "-ur" is shorter, I just wanted to
illustrate the mechanism verbosely. :-)

THis _should_ work with GELI encrypted partitions too, even
though I haven't tested it. Note that reverting back to r/o
could be delayed when writes are still pending; calling "sync"
should issue all buffers to be written. In worst case, -f can
be added (force), even when users are still holding files
open on from their r/w activity.

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list