Skip to content

node_filesystem_readonly does not report readonly bind mounts correctly #3484

Closed

Description

@codec

After upgrading node_exporter from 1.9.1 to 1.10.2, node_filesystem_readonly no longer correctly reports when the same device is mounted multiple times with different flags.

Example: A bind mount that is mounted with ro is now reported as writable.

/dev/sda1 / ext4 rw,relatime 0 0
/dev/sda1 /nix/store ext4 ro,nosuid,nodev,relatime 0 0

Expected behaviour

(with 1.9.1)

node_filesystem_readonly{device="/dev/sda1",device_error="",fstype="ext4",mountpoint="/"} 0
node_filesystem_readonly{device="/dev/sda1",device_error="",fstype="ext4",mountpoint="/nix/store"} 1

Actual behaviour

(with 1.10.2)

node_filesystem_readonly{device="/dev/sda1",device_error="",fstype="ext4",mountpoint="/"} 0
node_filesystem_readonly{device="/dev/sda1",device_error="",fstype="ext4",mountpoint="/nix/store"} 0

Activity

  1. dongjiang1989 commented on Nov 23, 2025

    @dongjiang1989
    Member
  2. discordianfish commented on Dec 17, 2025

    @discordianfish
    Member

    Not sure what is going on, we should consider the super options:

    func isFilesystemReadOnly(labels filesystemLabels) bool {

    That being said, I can't confirm this issue here. Just upgraded to 1.10.2 and tried with a bind-mount:

    mount --bind /pool-mirror-hdd/ /mnt -o ro
    mount|grep mirror-hdd
    pool-mirror-hdd on /pool-mirror-hdd type zfs (rw,xattr,noacl)
    pool-mirror-hdd on /mnt type zfs (ro,xattr,noacl)
    curl -s localhost:9100/metrics|grep 'readonly.*mnt'
    node_filesystem_readonly{device="pool-mirror-hdd",device_error="",fstype="zfs",mountpoint="/mnt"} 1
    

    @codec Can you try something similar and see if that shows up as read-only? There might be something different in the way nix sets this up?

  3. discordianfish commented on Dec 17, 2025

    @discordianfish
    Member

    Ah wait:

    mount --bind /pool-mirror-hdd/ /mnt -o ro,nosuid,nodev,relatime
    node_filesystem_readonly{device="pool-mirror-hdd",device_error="",fstype="zfs",mountpoint="/mnt"} 0
    

    Ok this is weird, somebody needs to give this a closer look. Nothing obvious wrong with the isFilesystemReadOnly function.

  4. added a commit that references this issue on Jan 15, 2026
  5. DesistDaydream commented on Feb 27, 2026

    @DesistDaydream

    https://github.com/torvalds/linux/blob/v5.19/Documentation/filesystems/proc.rst#35-----procpidmountinfo---information-about-mounts

    36 35 98:0 /mnt1 /mnt2 rw,noatime master:1 - ext3 /dev/root rw,errors=continue
    (1)(2)(3)   (4)   (5)      (6)     (n…m) (m+1)(m+2) (m+3)         (m+4)
    
    (1)   mount ID:        unique identifier of the mount (may be reused after umount)
    (2)   parent ID:       ID of parent (or of self for the top of the mount tree)
    (3)   major:minor:     value of st_dev for files on filesystem
    (4)   root:            root of the mount within the filesystem
    (5)   mount point:     mount point relative to the process's root
    (6)   mount options:   per mount options
    (n…m) optional fields: zero or more fields of the form "tag[:value]"
    (m+1) separator:       marks the end of the optional fields
    (m+2) filesystem type: name of filesystem of the form "type[.subtype]"
    (m+3) mount source:    filesystem specific information or "none"
    (m+4) super options:   per super block options
    

    Please review this section. Is the information in super options more suitable as the current real-time status? Is the value of this field more meaningful?

    >> grep home /proc/1/mounts
    /dev/sdb3 /home ext4 ro,relatime,stripe=704 0 0
    >> grep home /proc/1/mountinfo 
    274 94 8:19 / /home rw,relatime shared:98 - ext4 /dev/sdb3 ro,stripe=704
    >> mkdir /home/tmp
    mkdir: cannot create directory "/home/tmp": Read-only file system

    In this scenario, for the mountinfo file, the super options represent the current actual state.

    Or is it possible to add new metrics? e.g. node_filesystem_block_readonly, etc.

  6. added a commit that references this issue on Jun 9, 2026
    65902fa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedplatform/Linux

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions