[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zqrqo1lIrsxdm7AP@dread.disaster.area>
Date: Thu, 1 Aug 2024 11:53:39 +1000
From: Dave Chinner <david@...morbit.com>
To: Johannes Bauer <canjzymsaxyt@...rnkuller.de>
Cc: linux-ext4@...r.kernel.org
Subject: Re: Modification of block device by R/O mount
On Wed, Jul 31, 2024 at 01:16:26PM +0200, Johannes Bauer wrote:
> Is this expected behavior?
Yes. A read-only mount doesn't mean the filesystem cannot write to
the block device. All it means is that users cannot make
modifications to the filesystem contents once the filesystem is
mounted.
The filesystem may still have to do things like journal recovery on
a read-only mount which requires writing to the block device, or
maybe other house-keeping things that happen at mount time which
require writing updates to the superblock or other metadata.
This is not ext4 specific. XFS behaves the same way on read-only
mounts and, IIRC, JFS, Reiser and most other journalling filesystems
will also behave the same way.
> Is there a way to mitigate it?
If you want to stop the filesystem writing to the block device, you
have to set the -block device- to be read only. At this point, the
filesystem will refuse to mount if it needs to write to the block
device during mount.
Hence you may need to use "-ro,norecovery" on journalled filesystems
when the block device is read only to get them to mount. However,
this can expose inconsistent metadata to userspace and weird stuff
can happen because the journal will not have been recovered...
-Dave.
--
Dave Chinner
david@...morbit.com
Powered by blists - more mailing lists