Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Nov 2006 12:49:46 +0100 (CET)
From:      Oliver Fromme <olli@lurza.secnetix.de>
To:        freebsd-geom@FreeBSD.ORG, vanhu_bsd@zeninc.net
Subject:   Re: FSCKing a RO partition
Message-ID:  <200611061149.kA6BnkOb079135@lurza.secnetix.de>
In-Reply-To: <20061102143915.GA26008@zen.inc>

next in thread | previous in thread | raw e-mail | index | archive | help
VANHULLEBUS Yvan wrote:
 > [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.

A quick workaround would be to run "fsck -p" yourself on
the root partition before you remount it read-write.
You have to do that anyway, because the FS might be dirty
so you wouldn't be able to remount it r-w in the first
place (unless you apply "force", which is dangerous).

You will still get a warning message from fsck later,
but at least your root FS should be clean at that point.

Best regards
   Oliver

-- 
Oliver Fromme,  secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing
Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

"Perl will consistently give you what you want,
unless what you want is consistency."
        -- Larry Wall



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