From owner-freebsd-geom@FreeBSD.ORG Thu Nov 2 14:39:17 2006 Return-Path: X-Original-To: freebsd-geom@freebsd.org Delivered-To: freebsd-geom@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BAF8A16A407 for ; Thu, 2 Nov 2006 14:39:17 +0000 (UTC) (envelope-from vanhu@zeninc.net) Received: from smtp.zeninc.net (reverse-25.fdn.fr [80.67.176.25]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4054243D79 for ; Thu, 2 Nov 2006 14:39:17 +0000 (GMT) (envelope-from vanhu@zeninc.net) Received: by smtp.zeninc.net (smtpd, from userid 1000) id 6A5143F17; Thu, 2 Nov 2006 15:39:15 +0100 (CET) Date: Thu, 2 Nov 2006 15:39:15 +0100 From: VANHULLEBUS Yvan To: freebsd-geom@freebsd.org Message-ID: <20061102143915.GA26008@zen.inc> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: All mail clients suck. This one just sucks less. Subject: FSCKing a RO partition X-BeenThere: freebsd-geom@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: GEOM-specific discussions and implementations List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Nov 2006 14:39:17 -0000 Hi all. (problem reported first to FreeBSD-hackers, where people told me "GEOM"....). [background] When the system starts up, root partition is already monted RO, and fsck works, without any problems, without any warning. [my problem] Very early in the startup (in a custom init to be exact), I need to remount ROOT R/W, do some write operations, then I want to remount it RO to let the normal rc process continue. Under FreeBSD 4.11, it works. But under FreeBSD6 (and I guess 5, but I don't have a running FreeBSD5 host), fsck says "NO WRITE ACCESS", then starts its stuff (but I fear what will happen if it detect problems on the filesystem....). The RO remount is done by a call to mount(2), with MNT_RDONLY|MNT_UPDATE flags and MNT_EXRDONLY ex_flags. I also tried with the mount command and -u -r options with the same result. Can someone explain me why it works like that, and, most important for me, give me a way to remount the root partition exactly as it was mounted when init started ? Thanks, Yvan.