From owner-freebsd-questions@FreeBSD.ORG Thu Feb 13 12:29:09 2014 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 02D00D83 for ; Thu, 13 Feb 2014 12:29:09 +0000 (UTC) Received: from mailrelay4.qsc.de (mailrelay4.qsc.de [195.158.160.129]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 614201D16 for ; Thu, 13 Feb 2014 12:29:08 +0000 (UTC) Received: from mx01.qsc.de ([213.148.129.14]) by mailgate4.qsc.de; Thu, 13 Feb 2014 13:28:59 +0100 Received: from r56.edvax.de (port-92-195-112-109.dynamic.qsc.de [92.195.112.109]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx01.qsc.de (Postfix) with ESMTPS id 5AC6D3CB2A; Thu, 13 Feb 2014 13:28:59 +0100 (CET) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id s1DCSamG001970; Thu, 13 Feb 2014 13:28:36 +0100 (CET) (envelope-from freebsd@edvax.de) Date: Thu, 13 Feb 2014 13:28:36 +0100 From: Polytropon To: s m Subject: Re: Fwd: how to mount r/w encrypted partition when it is mount ad read-only? Message-Id: <20140213132836.5c04a470.freebsd@edvax.de> In-Reply-To: References: Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-cloud-security-sender: freebsd@edvax.de X-cloud-security-recipient: freebsd-questions@freebsd.org X-cloud-security-Virusscan: CLEAN X-cloud-security-disclaimer: This E-Mail was scanned by E-Mailservice on mailgate4 with B24851490002 X-cloud-security-connect: mx01.qsc.de[213.148.129.14], TLS=, IP=213.148.129.14 X-cloud-security: scantime:.1428 Cc: freebsd-questions X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list Reply-To: Polytropon List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Feb 2014 12:29:09 -0000 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. -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...