Skip to main content

Module disk

Module disk 

Source
Expand description

Disks and filesystems: free space, the mounted filesystems, and how hard the disks are working.

use sys_lib as sys;

let s = sys::disk::space(".")?;
println!("{} available of {} ({} used)", s.available, s.total, s.used_percent());

Structs§

DeviceIo
One disk’s rates.
Disk
One mounted filesystem.
DiskIo
How hard the disks worked over an interval.
IoCounters
One disk’s cumulative counters.
IoSampler
Measures disk activity between samples. Owned by the caller. sample never blocks and allocates nothing.
IoTotals
Cumulative I/O counters since boot.
ListOptions
Which filesystems list_with includes.
Space
The space on one filesystem.

Enums§

DiskKind
What kind of storage a Disk is on. Telling solid-state from rotating disks arrives in 0.5 (DSK-04); until then a fixed local disk is Unknown.

Constants§

DEFAULT_WINDOW
The interval io measures over: 1 s.

Functions§

io
Disk activity over the next second, every physical disk together. Blocks for DEFAULT_WINDOW; a monitor keeps an IoSampler.
io_counters
The cumulative counters of each physical disk (Tier 2).
io_over
Disk activity over window, clamped to 100 ms ..= 60 s. Blocks for the window.
io_totals
Bytes and operations since boot, every physical disk together: one read, no waiting, no allocation.
list
The local, real filesystems, sorted by mount point, each once.
list_with
The filesystems options selects, sorted by mount point.
of
The mount holding path. Only that filesystem is asked for its space, so a dead network mount elsewhere does not matter; path on one blocks.
pressure
How much time tasks were stalled on I/O (Pressure). Linux: the cgroup’s io.pressure, else /proc/pressure/io. macOS and Windows: None.
space
The space on the filesystem holding path: one system call, no allocation.