Re: Modification of block device by R/O mount

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

 



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@xxxxxxxxxxxxx




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux