Skip to content

opt-dist disk usage broken #159534

Description

@Mark-Simulacrum

Our disk usage calculation in opt-dist (

pub fn print_free_disk_space() -> anyhow::Result<()> {
) assumes that distinct disks will not be reported twice. However, currently sysinfo will report docker mounts (overlay fs) in addition to the main disk, leading to buggy double-counting:

$ docker run --rm -it -v `pwd`:/mnt ubuntu:26.04 /mnt/target/debug/check-sysinfo
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
[src/main.rs:3:9] disk = Disk("/dev/root")[FS: "ext4"][Type: Unknown(-1)][removable: no][I/O: DiskUsage { total_written_bytes: 0, written_bytes: 0, total_read_bytes: 0, read_bytes: 0 }] mounted on "/mnt": 225873375232/311227166720 B
[src/main.rs:4:9] humansize::format_size(disk.available_space(), humansize::BINARY) = "210.36 GiB"
[src/main.rs:3:9] disk = Disk("overlay")[FS: "overlay"][Type: Unknown(-1)][removable: no][I/O: DiskUsage { total_written_bytes: 0, written_bytes: 0, total_read_bytes: 0, read_bytes: 0 }] mounted on "/": 225873375232/311227166720 B
[src/main.rs:4:9] humansize::format_size(disk.available_space(), humansize::BINARY) = "210.36 GiB"

I suspect this is also the root cause of why Crater keeps filing up its disks... cc rust-lang/crater#762

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-opt-distArea: opt-dist tooling and workflowC-bugCategory: This is a bug.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions