hdd

Crates.iohdd
lib.rshdd
version0.10.3
sourcesrc
created_at2017-11-01 15:07:43.461596
updated_at2020-06-22 23:01:17.565439
descriptionhdd: instruments for querying ATA and SCSI disks
homepage
repositoryhttps://github.com/vthriller/hdd-rs
max_upload_size
id37676
size238,927
(vthriller)

documentation

README

hdd: instruments for querying ATA and SCSI disks

Documentation.

This is work in progress.

Why?

Mainly because I was disappointed in all the available options for putting SMART and SCSI log info into various monitoring systems.

  • Scripts that parse smartctl output (usually with regexes) are slow, ugly, unreliable hacks.
  • To add support for different, programming-friendly output format into smartctl (e.g. JSON), one basically needs to rewrite a lot of ad-hoc printfs scattered all over the source files, and it's not much easier if you decide to drop the idea of implementing some command-line switch in favour of simply changing the output format altogether. (Things are only getting more complex with smartd.)
  • libatasmart (and tools that it powers) can only work with ATA devices, and only on Linux, and expecting more from that library is simply naïve.

How?

Prerequisites

This crate can be built on Rust >= 1.21.

Building CLI tool

git clone https://github.com/vthriller/hdd-rs.git
cd hdd-rs
cargo build --release --features='bin serializable' --bin=hdd
sudo ./target/release/hdd /dev/sda attrs --json

(Sorry if that looks complicated.)

You can build static binary if, say, you want it for remote GNU/Linux system that runs older version of glibc:

  • install musl toolchain (e.g. via rustup target add x86_64-unknown-linux-musl),
  • append --target x86_64-unknown-linux-musl to the cargo build line.

Using library in your code

Put this into your Cargo.toml:

[dependencies]
hdd = "0.10"

What's supported?

Platforms and transports:

  • Linux: ATA¹, SCSI
  • FreeBSD: ATA, SCSI

SCSI/ATA translation is also supported.

¹ Note that in Linux, ATA is only supported through SAT, although SG_IO kindly emulates that for SATA (and, possibly, PATA?) disks for us.

Features:

  • TODO

To Do

  • Documentation.
  • Tests.
  • More tests.
  • Even more tests: big-endian systems, old hardware…
  • rg 'TODO|FIXME|XXX|((?i)WTF)|unimplemented!|\b(unwrap|expect)\b' src sample-scsi/src build.rs
  • Feature parity with [insert your favourite package name here].
  • Support for RAID weirdos (LSI, Adaptec, Areca, you name it) and USB bridges.
  • Debugging options (think smartctl -r ataioctl,2 or skdump) for CLI tool.
  • More devices (smartmontools can query NVMe devices).
  • More platforms (Windows, macOS, *BSD, Redox…).

Acknowledgements

Here goes obligatory mention of smartmontools contributors who laid foundations of what this crate currently is.

License

This crate is distributed under the terms of Mozilla Public License version 2.0.

Commit count: 467

cargo fmt