read-only-mount · shipping · also Linux read-only mount

Read-only mount

A read-only mount restricts filesystem modification through Linux mount state, whose scope can be a VFS mount node, the filesystem superblock, or both.

The util-linux v2.41.1 manual separates two layers: a requested ro setting applies to both layers by default for standard mounts, while -o bind,remount,ro changes only the mount node and can leave the filesystem writable through another path. [1] Btrfs may still replay its recovery log during a read-only mount. [2] Ext4 journal replay and XFS internal log recovery can also write during read-only mounting; suppressing recovery does not establish a consistent recovered view. [6] [7] [8]

Since util-linux 2.41, optional ro=vfs and ro=fs arguments select one layer. The v2.41.1 manual marks them experimental and requires the file-descriptor-based mount API. The old mount(2) interface silently ignores the optional argument. [1]

In the kernel, MS_RDONLY can be set per mount point as well as on the superblock since Linux 2.6.16, and a mount is writable only when neither flag is set. Since Linux 2.6.26, MS_REMOUNT combined with MS_BIND changes only the per-mount flags. [4]

mount_setattr, added in Linux 5.12 with a glibc 2.36 wrapper, sets MOUNT_ATTR_RDONLY on a mount without changing superblock parameters. Its struct mount_attr has a first published size of 32 bytes, four 64-bit fields. [5]

Relations

related
Mount point, Mount namespace, Bind mount, Btrfs read-only subvolume, Linux block-device read-only flag, Btrfs tree log, EROFS, SquashFS, Ext4, XFS, Mount propagation

Advantages

  • With AT_RECURSIVE, one mount_setattr call changes the entire mount tree, which the classic mount(2) call cannot do; libmount exposes this as ro=recursive since util-linux 2.39. [5, 1]
  • The change fails with EBUSY while the mount still holds files open for writing, so a successful switch leaves no writer open through that mount. [5]

Limitations

  • Read-only access through one path does not establish that the underlying device was unchanged. [1, 2]
  • The requested option spelling alone does not verify the effective layer; findmnt can report VFS-OPTIONS and FS-OPTIONS separately, but those flags are not an audit of device writes. [1]

Citations

  1. util-linux v2.41.1: mount(8), Read-only Setting Notes (accessed 2026-10-23)
  2. Btrfs documentation: tree-log replay and rescue options (accessed 2026-10-15)
  3. Linux man-pages: mount(2), per-mount MS_RDONLY and bind remount (accessed 2026-10-23)
  4. Linux man-pages: mount_setattr(2), MOUNT_ATTR_RDONLY and AT_RECURSIVE (accessed 2026-10-23)
  5. Linux v6.16: ext4 read-only mounts, journal replay and noload (accessed 2026-10-24)
  6. Linux v6.16: xfs_log_writable permits internal recovery writes on read-only mounts (accessed 2026-10-24)
  7. xfsprogs xfs(5): norecovery requires read-only mounting and can expose inconsistencies (accessed 2026-10-24)

Further reading

  1. Hesela: Btrfs tree logs and read-only scope boundaries (accessed 2026-10-15)
Sources & caveats
  • mount-scope is the util-linux v2.41.1 mount(8) source at the cited tag, re-read for the Read-only Setting Notes and the ro, vfs, fs and recursive arguments.
  • mount2 is the Linux man-pages 6.19 mount(2) page, read for the per-mount MS_RDONLY history in 2.6.16 and bind remount in 2.6.26.
  • setattr is the mount_setattr(2) page, read for MOUNT_ATTR_RDONLY, AT_RECURSIVE, EBUSY and the 5.12 and glibc 2.36 history. The 32-byte size was checked in include/uapi/linux/mount.h at v7.3.
  • The btrfs-tree-log entry links here because its log replay can still write during a read-only mount.
  • Ext4 and XFS recovery boundaries checked against Linux v6.16 and xfsprogs documentation; source review only, no mount or device-write experiment.

JSON: /data/terms/read-only-mount.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. Read-only mount. Hesela. 2026-11-15. https://hesela.dev/terms/read-only-mount/