NFS mounts are ignored in Disks stats #403

Open
opened 2025-10-31 15:10:55 -05:00 by GiteaMirror · 5 comments
Owner

Originally created by @kiler129 on GitHub (Jun 1, 2025).

Problem

Periphery seems to ignore NFS mounts when displaying disk stats:

Image

I found that get_disks() in stats.rs is responsible for listing disks in periphery's source code. However, the mount is neither overlayfs nor I defined either PERIPHERY_INCLUDE_DISK_MOUNTS or PERIPHERY_EXCLUDE_DISK_MOUNTS.

From the container side this is how the userland sees it:

# docker exec komodo-periphery-1 mount | grep '.disk-size'
<nfsServer>:/exports/.disk-size on /mnt/app-data/.disk-size type nfs4 (ro,....)
/dev/sdc1 on /mnt/docker-data/.disk-size type ext4 (ro,noatime,discard)

The NFS mount is created on the host (via standard /etc/fstab) and bound to the container like so:

    periphery:
        image: ghcr.io/moghtech/komodo-periphery:1.18.0
        # ....
        volumes:
            - /var/run/docker.sock:/var/run/docker.sock
            - /proc:/proc
            - /mnt/app-data/.disk-size:/mnt/app-data/.disk-size:ro
            - /mnt/docker-data/.disk-size:/mnt/docker-data/.disk-size:ro

Source of the issue

I did dig deeper and found that the issue stems from the upstream library. The NFS was deliberately disabled by default, as it could hang on errors. However, the sysinfo library added an option to re-enable all networked mounts about a year later.

Possible fix

Since I have zero experience in Rust, I didn't even attempt a PR. However, testing with this simple code:

use sysinfo::Disks;

fn main() {
    let disks = Disks::new_with_refreshed_list();
    for disk in &disks {
        println!("{disk:?}");
    }
}

I can indeed see that enablind linux-netdevs via cargo run -F sysinfo/linux-netdevs indeed brings NFS back. Due to potential hangs, I think Periphery should be compiled with linux-netdevs but introduce a default filter similar to sysinfo that filters-out networked filesystems. Such filter could be be controlled with PERIPHERY_INCLUDE_DISK_NET that defaults to false.

However, I'm not sure if the refresh is asynchronous-enough to prevent hangs on the sysinfo side anyway?

Originally created by @kiler129 on GitHub (Jun 1, 2025). ## Problem Periphery seems to ignore NFS mounts when displaying disk stats: ![Image](https://github.com/user-attachments/assets/76258ad8-1a8d-4093-afdf-6eed0e30b9b6) I found that [`get_disks()` in stats.rs](https://github.com/moghtech/komodo/blob/4cc0817b0f6d661961a628c71e5936fd5ad43d70/bin/periphery/src/stats.rs#L108-L147) is responsible for listing disks in periphery's source code. However, the mount is neither `overlayfs` nor I defined either `PERIPHERY_INCLUDE_DISK_MOUNTS` or `PERIPHERY_EXCLUDE_DISK_MOUNTS`. From the container side this is how the userland sees it: ``` # docker exec komodo-periphery-1 mount | grep '.disk-size' <nfsServer>:/exports/.disk-size on /mnt/app-data/.disk-size type nfs4 (ro,....) /dev/sdc1 on /mnt/docker-data/.disk-size type ext4 (ro,noatime,discard) ``` The NFS mount is created on the host (via standard `/etc/fstab`) and bound to the container like so: ```yaml periphery: image: ghcr.io/moghtech/komodo-periphery:1.18.0 # .... volumes: - /var/run/docker.sock:/var/run/docker.sock - /proc:/proc - /mnt/app-data/.disk-size:/mnt/app-data/.disk-size:ro - /mnt/docker-data/.disk-size:/mnt/docker-data/.disk-size:ro ``` ## Source of the issue I did dig deeper and found that the issue stems from the upstream library. The NFS was [deliberately disabled](https://github.com/GuillaumeGomez/sysinfo/pull/876) by default, as it could [hang on errors](https://github.com/GuillaumeGomez/sysinfo/issues/842). However, the `sysinfo` library added an option to re-enable all networked mounts [about a year later](https://github.com/GuillaumeGomez/sysinfo/pull/1147). ## Possible fix Since I have zero experience in Rust, I didn't even attempt a PR. However, testing with this simple code: ```rust use sysinfo::Disks; fn main() { let disks = Disks::new_with_refreshed_list(); for disk in &disks { println!("{disk:?}"); } } ``` I can indeed see that enablind `linux-netdevs` via `cargo run -F sysinfo/linux-netdevs` indeed brings NFS back. Due to potential hangs, I think Periphery should be compiled with `linux-netdevs` but introduce a default filter [similar to `sysinfo`](https://github.com/GuillaumeGomez/sysinfo/blob/c2a92834f0adef65715e3f028ef3c4e23a513c7a/src/unix/linux/disk.rs#L397) that filters-out networked filesystems. Such filter could be be controlled with `PERIPHERY_INCLUDE_DISK_NET` that defaults to `false`. However, I'm not sure if the refresh is asynchronous-enough to prevent hangs on the `sysinfo` side anyway?
GiteaMirror added the enhancement label 2025-10-31 15:10:55 -05:00
Author
Owner

@mbecker20 commented on GitHub (Jun 1, 2025):

Interesting, thanks for looking into it.

@mbecker20 commented on GitHub (Jun 1, 2025): Interesting, thanks for looking into it.
Author
Owner

@kiler129 commented on GitHub (Jun 17, 2025):

@mbecker20 Did you maybe have a chance to look at it, or would you like me to try to explore adding this option?

@kiler129 commented on GitHub (Jun 17, 2025): @mbecker20 Did you maybe have a chance to look at it, or would you like me to try to explore adding this option?
Author
Owner

@mbecker20 commented on GitHub (Jun 19, 2025):

I don't use any NFS mounts so not really in a position to verify if changes work. Additionally, it may be better to contribute any fix to the sysinfo library itself, if they support nfs then Komodo will by extension.

@mbecker20 commented on GitHub (Jun 19, 2025): I don't use any NFS mounts so not really in a position to verify if changes work. Additionally, it may be better to contribute any fix to the sysinfo library itself, if they support nfs then Komodo will by extension.
Author
Owner

@kiler129 commented on GitHub (Jun 23, 2025):

@mbecker20 To clear things up a bit, I was initially planning to bring changes to sysinfo directly. However, it seems that they back-tracked on their decision to filter-out any network mounts and it does work as long as linux-netdevs feature flag is enabled during compile time.
In other words, to make it work in Komodo no changes are needed on the sysinfo side, but Komodo needs to be compiled with linux-netdevs enabled.

@kiler129 commented on GitHub (Jun 23, 2025): @mbecker20 To clear things up a bit, I was initially planning to bring changes to `sysinfo` directly. However, it seems that they back-tracked on their decision to filter-out any network mounts and it does work **as long as** `linux-netdevs` feature flag is enabled during compile time. In other words, to make it work in Komodo no changes are needed on the `sysinfo` side, but Komodo needs to be compiled with `linux-netdevs` enabled.
Author
Owner

@mbecker20 commented on GitHub (Jun 26, 2025):

Understood, although my comment still applies. My worry is if there is some issue with enabling the flag, I don't use NFS to test the stability of things myself. You also mentioned a periphery flag to control whether to filter out nfs, but if there is a hang under the hood I'm not sure disabling this would fix the issue, since it would still be fetching the nfs stats under the hood with the flag enabled. So I am a bit unsure about whether this could introduce unresolvable issues re hanging, which I cannot verify before release.

@mbecker20 commented on GitHub (Jun 26, 2025): Understood, although my comment still applies. My worry is if there is some issue with enabling the flag, I don't use NFS to test the stability of things myself. You also mentioned a periphery flag to control whether to filter out nfs, but if there is a hang under the hood I'm not sure disabling this would fix the issue, since it would still be fetching the nfs stats under the hood with the flag enabled. So I am a bit unsure about whether this could introduce unresolvable issues re hanging, which I cannot verify before release.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/komodo#403