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§
- Device
Io - 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.
samplenever blocks and allocates nothing. - IoTotals
- Cumulative I/O counters since boot.
- List
Options - Which filesystems
list_withincludes. - Space
- The space on one filesystem.
Enums§
- Disk
Kind - What kind of storage a
Diskis on. Telling solid-state from rotating disks arrives in 0.5 (DSK-04); until then a fixed local disk isUnknown.
Constants§
- DEFAULT_
WINDOW - The interval
iomeasures over: 1 s.
Functions§
- io
- Disk activity over the next second, every physical disk together.
Blocks for
DEFAULT_WINDOW; a monitor keeps anIoSampler. - 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
optionsselects, 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;pathon one blocks. - pressure
- How much time tasks were stalled on I/O (
Pressure). Linux: the cgroup’sio.pressure, else/proc/pressure/io. macOS and Windows:None. - space
- The space on the filesystem holding
path: one system call, no allocation.