Skip to content

Conversation

@Paol0B
Copy link

@Paol0B Paol0B commented Jan 10, 2026

This pull request introduces a new Rust utility for listing block device information, similar to the lsblk command. The implementation includes a full-featured binary crate setup and a complete device scanning and display logic, integrating with the workspace conventions and using modern Rust libraries.

New utility implementation:

  • Added a new binary crate uu_lsblk with its own Cargo.toml, specifying dependencies (uucore, clap), workspace metadata, and binary/lib entry points.
  • Implemented the main logic in lsblk.rs to scan /sys/class/block, parse device/partition information, and display a formatted tree of block devices, including mount points and device attributes.
  • Provided a simple entry point in main.rs to invoke the utility using the uucore macro.

Command-line interface and device parsing:

  • Utilizes clap for argument parsing, supporting an --all flag to show all devices, and reads mount information from /proc/mounts for display.
  • Implements recursive device tree building and formatted output, including size formatting and hierarchical display of devices and partitions.

@TheEssem
Copy link

TheEssem commented Jan 11, 2026

This should be implemented in https://github.com/uutils/util-linux.

@Paol0B Paol0B closed this Jan 11, 2026
@Paol0B Paol0B deleted the add-lsblk branch January 11, 2026 07:05
@Paol0B Paol0B restored the add-lsblk branch January 12, 2026 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants