#mount #swap #linux #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

#146 in Unix APIs

Download history 4237/week @ 2023-12-01 6395/week @ 2023-12-08 6667/week @ 2023-12-15 2432/week @ 2023-12-22 3356/week @ 2023-12-29 5600/week @ 2024-01-05 5255/week @ 2024-01-12 5516/week @ 2024-01-19 4664/week @ 2024-01-26 4229/week @ 2024-02-02 5921/week @ 2024-02-09 4810/week @ 2024-02-16 5878/week @ 2024-02-23 5648/week @ 2024-03-01 4393/week @ 2024-03-08 3640/week @ 2024-03-15

20,460 downloads per month
Used in 26 crates (14 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

~300–750KB
~18K SLoC