#linux #mount #swap #proc

proc-mounts

Fetch active mounts and swaps on a Linux system

9 releases

0.3.0 Mar 21, 2022
0.2.4 Apr 9, 2020
0.2.3 Nov 8, 2019
0.2.2 Feb 20, 2019
0.1.0 Nov 2, 2018

#248 in Unix APIs

Download history 10527/week @ 2024-11-18 4115/week @ 2024-11-25 4606/week @ 2024-12-02 4972/week @ 2024-12-09 4661/week @ 2024-12-16 2817/week @ 2024-12-23 3302/week @ 2024-12-30 4526/week @ 2025-01-06 4821/week @ 2025-01-13 4853/week @ 2025-01-20 4162/week @ 2025-01-27 5335/week @ 2025-02-03 4426/week @ 2025-02-10 4701/week @ 2025-02-17 5034/week @ 2025-02-24 3996/week @ 2025-03-03

18,518 downloads per month
Used in 28 crates (15 directly)

MIT license

24KB
531 lines

proc-mounts

Rust crate that provides easy access to data from the /proc/swaps and /proc/mounts files.

extern crate proc_mounts;

use proc_mounts::{MountIter, SwapIter};
use std::io;

fn main() -> io::Result<()> {
    println!("# Active Mounts");
    for mount in MountIter::new()? {
        println!("{:#?}", mount);
    }

    println!("# Active Swaps");
    for swap in SwapIter::new()? {
        println!("{:#?}", swap);
    }

    Ok(())
}

lib.rs:

Provides easy access to data from the /proc/swaps and /proc/mounts files.

extern crate proc_mounts;

use proc_mounts::{MountIter, SwapIter};
use std::io;

fn main() -> io::Result<()> {
    println!("# Active Mounts");
    for mount in MountIter::new()? {
        println!("{:#?}", mount);
    }

    println!("# Active Swaps");
    for swap in SwapIter::new()? {
        println!("{:#?}", swap);
    }

    Ok(())
}

Dependencies

~230–680KB
~16K SLoC