[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: assurance that / is read-only before fsck

Robert Sanders writes:
> Here's what I have in my rc.S now:
> ...
>         mount -n -o remount,ro /
> This obviously isn't perfect, but it at least tries to force the root
> directory to be read-only, and it's much less error prone than any
> other mothod I've seen.  At one point I had the script checking root's
> writability by echoing to a reserved file in /etc, but that's ugly,
> and the above solution will correct an improperly installed kernel.

I don't think this is safe.

I was under the impression that if you mount a fs read-write, then
read-only, and then read-write again, the kernel can buffer stuff
across the remount(s) in such a way that the filesystem can get
corrupted if you modify the fs while it is read-only.

I'd like to see someone knowledgeable about such things comment.

If this is true then perhaps attempting a test write to a file in /tmp
would be a better idea.


Reply to: